davehughes87
New Member
Hi guys,
Complete novice here. I bought the PICAXE-08 Servo Driver Board kit and I'm attempting to control a servo using an on-off-on toggle switch controlling two inputs to allow it to move either way. The end goal is that the system will open and close some window blinds at work so I don't have to keep getting up. I am THAT lazy!
I've completed the build of the board kit. I've connected my servo to "2" and written a very simple program to move it around. It works!
I've then connected the two "on" positions of the toggle switch to the pins intended for the positive voltage and signal pins of servo "1" and "4". I know these pins were intended to be servo outputs in this kit, but I was under the impression the PICAXE could be programmed to treat these pins as inputs. I've written a very simple (and probably wrong) program - pasted below - to cause the servo to react to the switch's position. It's no longer working.
I'm struggling to understand where I'm going wrong. Is my code wrong? Can I not use these pins as inputs? Any tips are greatly appreciated. (Please bear in mind I'm a complete beginner!)
Thanks for any help.
Dave
*pin numbers might be wrong - but I've tried all sorts of combinations and not got anywhere!
Complete novice here. I bought the PICAXE-08 Servo Driver Board kit and I'm attempting to control a servo using an on-off-on toggle switch controlling two inputs to allow it to move either way. The end goal is that the system will open and close some window blinds at work so I don't have to keep getting up. I am THAT lazy!
I've completed the build of the board kit. I've connected my servo to "2" and written a very simple program to move it around. It works!
I've then connected the two "on" positions of the toggle switch to the pins intended for the positive voltage and signal pins of servo "1" and "4". I know these pins were intended to be servo outputs in this kit, but I was under the impression the PICAXE could be programmed to treat these pins as inputs. I've written a very simple (and probably wrong) program - pasted below - to cause the servo to react to the switch's position. It's no longer working.
I'm struggling to understand where I'm going wrong. Is my code wrong? Can I not use these pins as inputs? Any tips are greatly appreciated. (Please bear in mind I'm a complete beginner!)
Thanks for any help.
Dave
*pin numbers might be wrong - but I've tried all sorts of combinations and not got anywhere!
Code:
init:
servopos 2, 100 ; initialise servo
input C.1
input C.4
main:
if pinC.1 = 1 then bob
if pinC.4 = 1 then dog
bob:
pause 100
servopos 2, 200
goto main
dog:
pause 100
servopos 2, 150
goto main