Bstamp with hb25
joy1
Posts: 32
Hello, I'm trying to hook up a linear actuator to a HB25 controller and switch....what I need is for the actuator to move out when the switch is on and in when the switch is off...the code I am putting below does not work well...when it does work it's "glichy" by not moving smoothly...and its inconsistent in when it works or doesn't (lots of time the switch is activated and nothing happens)
Any help would be appreciated
Here's the code:
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ Program Description ]
' This program works with one linear actuator hooked up to one motor controller
'The actuator moves out if "1" is seen and in if "0" is seen
'
[ I/O Definitions ]
linear PIN 1 'I/O Pin for linear actuator
'
[ Variables ]
'
[ Initialization ]
DO : LOOP UNTIL linear = 1 ' Wait For HB-25 Power Up
LOW linear ' Make I/O Pin Output/Low
PAUSE 5 ' Wait For HB-25 To Initialize
PULSOUT linear, 750 ' Stop linear actuator
'
[ Program Code ]
Main:
DO
IF (IN3 = 1) THEN
PULSOUT linear, 500 'moves linear actuator forward...linear actuator is extended.
PAUSE 400
ELSE
PULSOUT linear, 1000
PAUSE 20
ENDIF
LOOP
Any help would be appreciated
Here's the code:
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ Program Description ]
' This program works with one linear actuator hooked up to one motor controller
'The actuator moves out if "1" is seen and in if "0" is seen
'
[ I/O Definitions ]
linear PIN 1 'I/O Pin for linear actuator
'
[ Variables ]
'
[ Initialization ]
DO : LOOP UNTIL linear = 1 ' Wait For HB-25 Power Up
LOW linear ' Make I/O Pin Output/Low
PAUSE 5 ' Wait For HB-25 To Initialize
PULSOUT linear, 750 ' Stop linear actuator
'
[ Program Code ]
Main:
DO
IF (IN3 = 1) THEN
PULSOUT linear, 500 'moves linear actuator forward...linear actuator is extended.
PAUSE 400
ELSE
PULSOUT linear, 1000
PAUSE 20
ENDIF
LOOP
Comments