serial sent delay time
June 1, 2012
I've attached a copy of what I'm using for a simple tank drive bot with pan & tilt setup.
I've also made a couple of android bluetooth apps to control it.
My problem is how to add a statement to each of the following commands like:
"if delay number sent after letter store number to timevar1 for delay & do for the delay time:"
// U (85) = Forward
// D (68) = Backward
// L (76) = Left
// R (82) = Right
// S (83) = Stop
// A (65) = Turn On LED1
// B (66) = Turn Off LED1
// C (67) = Toggle LED2 ON/OFF
// Z (90) = Do a 180 u-turn (backwards to the left) & then go forward.
// Y (89) = Do a 360 turn (stop turn right) & then go forward.
I've set up an app to send "<" before a letter
and ">" after the delay time number.
After hours of reading, the 2 links below come close to explaining what I need to do, but I still dont understand enough to make it work.
I would like to be able to send the pan & tilt commands while the bot runs through a string of motor cotrol commands.
I asume this means I can't use the delay function, so I've added the timer libary, but I've not used timer libary before.
Again after alot of reading still unsure how to implament timer as a delay.
I've also added & edited out some statements of what I think I need for the "U (85) = Forward" command.
I would greatly appreciate it if someone could edit the "U (85) = Forward" command so as to work like the following:
If I send "U" or "<U" the bot go's forward. (this part is working)
If I send "<U3000>S" the bot go's forward for 3 seconds then stops. (stuck here)
Even if someone can make it work using the delay command & there for stopping the pan & tilt commands, I would then be able to use there example to sort out the rest of the commands.
Thanks in advance for any help provided.