walk/chew gum....simultaniously
· I am looking for a code that will allow me to program my Boe-bot to drive foward and flash·LED's·simultaniously. The problem is that either the servos will operate, or the LED's will operate. The other senario is that the LED's will run the same PULSOUT or HIGH/LOW command that the servos are using, so the flash sequence remains the same as servo duration.
·
·The Stamp wants to·handle commands only on an On-Off basis·for each of the I/O pins. Is there a way to isolate data packets that can be ignored by the rest of the program, thereby allowing me to run the LED's in any sequence that I wish despite·specific·commands to the servos?·
·· AJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PSALM 23
Post Edited (Husky X3) : 11/21/2007 5:23:43 PM GMT
·
·The Stamp wants to·handle commands only on an On-Off basis·for each of the I/O pins. Is there a way to isolate data packets that can be ignored by the rest of the program, thereby allowing me to run the LED's in any sequence that I wish despite·specific·commands to the servos?·
·· AJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PSALM 23
Post Edited (Husky X3) : 11/21/2007 5:23:43 PM GMT

Comments
This might give you an idea of how to tackle it:
ledCntr VAR Byte 'time slice speedL VAR Byte 'motor speed speedR VAR Byte 'motor speed motoL PIN 0 motoR PIN 1 leds VAR OUTC '4 leds on output states of pins 8-11 DIRC = %1111 'make leds outputs leds = %0101 'turn on two of 'em Main: ' the goal is for the main loop to take about 20ms including send time on the pulses ' do some stuff speedL = 120 speedR = 170 'IF obstacle, change speed, etc 'more stuff Update_Leds: ledCntr = ledCntr + 1 'each pass through loop increment counter -- each "tick" = ~20ms IF ledCntr = 5 THEN 'every 100ms (approx.) change the LEDs -- this is still pretty fast ledCntr = 0 'reset counter leds = ~leds 'just invert 'em, or put lots of fancy patterns here. Make the "5" above a variable to change speed of pattern "on the fly" ENDIF Send_Motors: GOSUB SEND_PULSES End_Main_Loop: 'PAUSE 5 '---- strictly optional pause IF you need to pad the loop -- usually you will be tight, not loose, but you never know GOTO Main '----------- SEND_PULSES: 'PULSOUT motoL, speedL, etc 'PULSOUT motoR, speedR, etc RETURN▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
· AJ
P.S.
that is some code, Zoot, thanks. I will give it a shot.
i APPRECIATE EVERYONE'S HELP AND COMMENTS! thank you all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PSALM 23
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
'Output Pins
LEDPIN1 PIN ??
LEDPIN2 PIN ???
DO
Hight LEDPIN1
Low LEDPIN2
FOR idx = 1 to 50
GOSUB YourCodeToControlServo
NEXT
LOW LEDPIN1
High LEDPIN2
FOR idx = 1 to 50
GOSUB YourCodeToControlServo
NEXT
LOOP
YourCodeToControlServo:
Your code goes here as a sub.
RETURN
Change the value(s) of idx to suit your needs.
You might also want to try RANDOM and OUTS in place of the High and Low.
I hope this helps.
SJW
What we're saying is that you have to interleave the servo handling and the LED handling rather than do one, than the other. It is certainly clearer and more straightforward to use something like a ServoPAL, but the Stamps can handle servos and LEDs at the same time with the interleaving.