problem I need help with
studentRobotMaster
Posts: 2
I wrote a simple program, just to play around with functions (subroutines) and the EEPROM memory stuff. Basically, it's supposed to ramp up to speed, drive forward, backwards, forwards, and then ramp down again. However, running the program, only the left wheel turns, not the right. I's not a hardware problem, because the wheel runs fine with other programs. Any help is appreciated. Here is my code:
' {$STAMP BS2} ' {$PBASIC 2.5} counter VAR Word pulsecount VAR Word address VAR Byte instruction VAR Byte DATA "UFFBBFFD" DO UNTIL (instruction = "Q") READ address, instruction address = address + 1 SELECT instruction CASE "F": GOSUB forward CASE "B": GOSUB backward CASE "U": GOSUB ramp_up_forward CASE "D": GOSUB ramp_down_forward ENDSELECT LOOP END forward: FOR counter = 1 TO 25 PULSOUT 13, 800 PULSOUT 12, 700 PAUSE 20 NEXT backward: FOR counter = 1 TO 25 PULSOUT 13, 700 PULSOUT 12, 800 PAUSE 20 NEXT ramp_up_forward: FOR pulsecount = 1 TO 100 PULSOUT 13, 750 + pulsecount PULSOUT 13, 750 - pulsecount PAUSE 20 NEXT ramp_up_backward: FOR pulsecount = 1 TO 100 PULSOUT 13, 750 - pulsecount PULSOUT 13, 750 + pulsecount PAUSE 20 NEXT ramp_down_forward: FOR pulsecount = 100 TO 1 PULSOUT 13, 750 + pulsecount PULSOUT 13, 750 - pulsecount PAUSE 20 NEXT ramp_down_backward: FOR pulsecount = 100 TO 1 PULSOUT 13, 750 - pulsecount PULSOUT 13, 750 + pulsecount PAUSE 20 NEXT
Comments
The second PulseOut should be changed to PULSEOUT 12 to drive the other wheel.
well, that's a facepalm if I've ever seen one! I really should have seen that; thank you for your help! It works great now!
Good deal. Merry Christmas!