Question regarding Spin IF statement with Pushbutton
NWCCTV
Posts: 3,629
I am trying to start a couple servos when a button is pushed. I am not sure what is wrong with my code but I am sure my PB circuit is correct. The code compiles just fine but the servos do not turn.
OBJ servo : "PropBOE Servos" 'Servo control object CON _clkmode = xtal1 + pll16x ' Feedback and PLL multiplier _xinfreq = 5_000_000 ' External oscillator = 5 MHz PushButton = 3 ' Pushbutton Input Pin PUB main ' Main method 'repeat if [PushButton] == 1 ' wait for pushbutton to be pushed servo.Set(15, 200) ' Start Servo on pin 15 Counterclockwise servo.Set(14,-200) ' Start Servo on pin 14 Clockwise else servo.stop ' Stop Servo on pin 15 servo.stop ' Stop Servo on pin 14
Comments