HB-25 controller via IR Help!!
Hello everyone, pleased to meet you all, i'm a little newbie...and i'm a little stuck...and need some help, here it goes:
I little car, with 2 motors and a ball in front as third wheel. all good i used 2 HB-25 motor controllers for my 2 motors all good is working great. Down below is my program.
All good and fine....The problem is now, i put an IR and i'm trying make it work via IR. All good i made the circuit i runed a program and it works, but i want to make it like this: when i push the remotes button i want the motors to work as long as i keep the button pushed, not just push the button and work for 5 mS and stop and i have to push the button again. I would like to just keep the button pushed and as long as is pushed to just go in front for example, and when i take my finger off the button, the car to just stop.Down below is the program i used, if someone can tell me what to modify, or what to add, pls take yout time. Thanks.
This code is added to my first program.This second program is for boe bot and is working fine. the thing is i don't know what to add or delete from my sub to make it work. i hope you all understand. below is the all program:
I hope you can help me thanks again
I little car, with 2 motors and a ball in front as third wheel. all good i used 2 HB-25 motor controllers for my 2 motors all good is working great. Down below is my program.
' {$STAMP BS2} ' {$PBASIC 2.5} ' -----[noparse][[/noparse] I/O Definitions ]------------------------------------------------- HB25 PIN 15 ' I/O Pin For HB-25 ' -----[noparse][[/noparse] Variables ]------------------------------------------------------- index VAR Word ' Counter For Ramping ' -----[noparse][[/noparse] Initialization ]-------------------------------------------------- DO : LOOP UNTIL HB25 = 1 ' Wait For HB-25 Power Up LOW HB25 ' Make I/O Pin Output/Low PAUSE 5 ' Wait For HB-25 To Initialize PULSOUT HB25, 750 ' Stop Motor 1 PAUSE 1 ' 1 mS Delay PULSOUT HB25, 750 ' Stop Motor 2 (If Connected) ' The Above 2 Lines May Be Removed ' If You Are Using Single Mode ' -----[noparse][[/noparse] Program Code ]------------------------------------------------- GOSUB Front PAUSE 500 GOSUB Right PAUSE 500 END Front: PAUSE 20 ' Wait 20 mS Before Ramping FOR index = 0 TO 300 ' Ramp Up To Full Speed PULSOUT HB25, 750 + index ' Motor 1 Forward PAUSE 1 ' 1 mS Delay For Motor 2 Pulse PULSOUT HB25, 750 - index ' Motor 2 Reverse PAUSE 20 ' 20 mS Smoothing Delay NEXT PAUSE 1000 ' Wait 3 Seconds FOR index = 300 TO 0 ' Ramp Back Down PULSOUT HB25, 750 + index ' Motor 1 Forward Slowing PAUSE 1 ' 1 mS Delay For Motor 2 PULSOUT HB25, 750 - index ' Motor 2 Reverse Slowing PAUSE 20 ' 20 mS Smoothing Delay NEXT RETURN Right: PAUSE 20 ' Wait 20 mS Before Ramping FOR index = 0 TO 0 ' Ramp Up To Full Speed PULSOUT HB25, 0 + index ' Motor 1 Forward PAUSE 1 ' 1 mS Delay For Motor 2 Pulse PULSOUT HB25, 750 - index ' Motor 2 Reverse PAUSE 20 ' 20 mS Smoothing Delay NEXT PAUSE 1000 ' Wait 3 Seconds FOR index = 300 TO 0 ' Ramp Back Down PULSOUT HB25, 0 + index ' Motor 1 Forward Slowing PAUSE 1 ' 1 mS Delay For Motor 2 PULSOUT HB25, 750 - index ' Motor 2 Reverse Slowing PAUSE 20 ' 20 mS Smoothing Delay NEXT RETURN
All good and fine....The problem is now, i put an IR and i'm trying make it work via IR. All good i made the circuit i runed a program and it works, but i want to make it like this: when i push the remotes button i want the motors to work as long as i keep the button pushed, not just push the button and work for 5 mS and stop and i have to push the button again. I would like to just keep the button pushed and as long as is pushed to just go in front for example, and when i take my finger off the button, the car to just stop.Down below is the program i used, if someone can tell me what to modify, or what to add, pls take yout time. Thanks.
'{$STAMP BS2} '{$PBASIC 2.5} time VAR Word(2) ' SONY TV remote variables. DEBUG "Press and hold a digit key (1-4) or CH+/- and VOL+/-..." FREQOUT 4, 2000, 3000 ' Start/reset indicator. DO ' Beginning of main loop. DO ' Wait for rest between messages. PULSIN 9, 1, time(0) LOOP UNTIL time(0) > 1000 PULSIN 9, 0, time(0) PULSIN 9, 0, time(1) ' Measure/store data pulses. ' Decide which maneuver to execute depending on the combination ' of pulse durations stored in the first two pulse measurem IF (time(1) < 500) AND (time(0) < 500) THEN GOSUB Front ELSEIF (time(1) < 500) AND (time(0) > 500) THEN GOSUB Right ENDIF LOOP
This code is added to my first program.This second program is for boe bot and is working fine. the thing is i don't know what to add or delete from my sub to make it work. i hope you all understand. below is the all program:
'{$STAMP BS2} '{$PBASIC 2.5} time VAR Word(2) ' SONY TV remote variables. DEBUG "Press and hold a digit key (1-4) or CH+/- and VOL+/-..." FREQOUT 4, 2000, 3000 ' Start/reset indicator. DO ' Beginning of main loop. DO ' Wait for rest between messages. PULSIN 9, 1, time(0) LOOP UNTIL time(0) > 1000 PULSIN 9, 0, time(0) PULSIN 9, 0, time(1) ' Measure/store data pulses. ' Decide which maneuver to execute depending on the combination ' of pulse durations stored in the first two pulse measurem IF (time(1) < 500) AND (time(0) < 500) THEN GOSUB Front ELSEIF (time(1) < 500) AND (time(0) > 500) THEN GOSUB Right ENDIF LOOP ' -----[noparse][[/noparse] I/O Definitions ]------------------------------------------------- HB25 PIN 15 ' I/O Pin For HB-25 ' -----[noparse][[/noparse] Variables ]------------------------------------------------------- index VAR Word ' Counter For Ramping ' -----[noparse][[/noparse] Initialization ]-------------------------------------------------- DO : LOOP UNTIL HB25 = 1 ' Wait For HB-25 Power Up LOW HB25 ' Make I/O Pin Output/Low PAUSE 5 ' Wait For HB-25 To Initialize PULSOUT HB25, 750 ' Stop Motor 1 PAUSE 1 ' 1 mS Delay PULSOUT HB25, 750 ' Stop Motor 2 (If Connected) ' The Above 2 Lines May Be Removed ' If You Are Using Single Mode ' -----[noparse][[/noparse] Program Code ]------------------------------------------------- GOSUB Front PAUSE 500 GOSUB Right PAUSE 500 END Front: PAUSE 20 ' Wait 20 mS Before Ramping FOR index = 0 TO 300 ' Ramp Up To Full Speed PULSOUT HB25, 750 + index ' Motor 1 Forward PAUSE 1 ' 1 mS Delay For Motor 2 Pulse PULSOUT HB25, 750 - index ' Motor 2 Reverse PAUSE 20 ' 20 mS Smoothing Delay NEXT PAUSE 1000 ' Wait 3 Seconds FOR index = 300 TO 0 ' Ramp Back Down PULSOUT HB25, 750 + index ' Motor 1 Forward Slowing PAUSE 1 ' 1 mS Delay For Motor 2 PULSOUT HB25, 750 - index ' Motor 2 Reverse Slowing PAUSE 20 ' 20 mS Smoothing Delay NEXT RETURN Right: PAUSE 20 ' Wait 20 mS Before Ramping FOR index = 0 TO 0 ' Ramp Up To Full Speed PULSOUT HB25, 0 + index ' Motor 1 Forward PAUSE 1 ' 1 mS Delay For Motor 2 Pulse PULSOUT HB25, 750 - index ' Motor 2 Reverse PAUSE 20 ' 20 mS Smoothing Delay NEXT PAUSE 1000 ' Wait 3 Seconds FOR index = 300 TO 0 ' Ramp Back Down PULSOUT HB25, 0 + index ' Motor 1 Forward Slowing PAUSE 1 ' 1 mS Delay For Motor 2 PULSOUT HB25, 750 - index ' Motor 2 Reverse Slowing PAUSE 20 ' 20 mS Smoothing Delay NEXT RETURN
I hope you can help me thanks again
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
, and for the boe bot works good, i mean as long as i keep the button pushed it goes ahead and went i take the finger off the button it stops.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen