Shop OBEX P1 Docs P2 Docs Learn Events
Assistance Needed! Programming Sinusoidal Motion and an Infrared Swarm — Parallax Forums

Assistance Needed! Programming Sinusoidal Motion and an Infrared Swarm

HiveMindHiveMind Posts: 3
edited 2010-03-01 01:18 in BASIC Stamp
Alright, so I was·experimenting·on establishing infrared communication·between my·Homework Board (R) and my Board of Education (R).
·I'm trying to get the Board of Education to track the Homework Board from a distance of 8ft.

Currently, the Homework Board is outfitted with:
·-Infrared LED('s) x3
·-220Ω resistors·x3

The Board of Education has:
·-Yellow LED('s) x2
·-Infrared Receiver(s) x2
·-220Ω resistor(s) x4······· *I think they're 220Ω, they're red-red-brown*
·-Standard motors on·P12 and P13
·

The Board of Education can usually track correctly towards the Homework Board for about 4 ft (out of 8ft) and then it will often lose signal.
Although going straight even after loss of signal would bring it to its destination, this won't be possible once it begins tackling curves etc.
I have decided that I should program the robot to move sinusoidaly upon the loss of signal, instead of just linear motion.
So, does anyone know how to easily program sinusoidal motion? I already programmed the robot to move in a circle, and could probably just alternate between half circles. However,·I would prefer it if someone could help me find an easier way because currently my circular motion program is rather tricky.

Here's the circle source code:

' {$STAMP BS2}
' {$PBASIC 2.5}


DO
PULSOUT 12, X

PULSOUT 13, Y
LOOP

(With (798, 720), (800, 719), (810, 713), (830, 700) as the coordinate pairs for PULSOUT commands.) [noparse][[/noparse]Basically, +8 on the X for every -5 on the Y]
The reason it is tricky is because I'm having trouble with motors and timing etc. its all rather confusing for me, so I wondered if somebody could help me identify how many loops the robot should run through before it switches the X and Y. Also, if somebody could help me figure out a suitable radius for the half-circles if its got 4ft of space between it and the target, that would be awesome.scool.gif

[noparse][[/noparse]P.S. does anyone know the maximum angle of detection for the normal infrared receivers?]


Post Edited (HiveMind) : 2/28/2010 11:37:13 PM GMT

Comments

  • HiveMindHiveMind Posts: 3
    edited 2010-03-01 01:18
    nvm about the ration, its kind of annoying, dont know it its working, did the first time though...
Sign In or Register to comment.