As I have stated prior, I have no code experience. I can not seem to get a switch and a trigger to work at all.
All in all, the code seems to work for me, that is until I inserted “if __then” statements. The main body will still work, but the switches has no influence on the code.
Here is the lay out:
C.4 will be connected to the main start button. So, I want the system to be dead until that button is pressed. I believe I currently have the pin pulled low until the button is hit.
Currently when I turn on power, the prop will begin to run. The switch has no effect.
Secondly the dump rod does not run at all.
What I need to happen is that a second switch will be triggered to turn off the dump rod.
That switch will be connected to C.3.
Again, currently pulled low.
I used the diagram in Manual 3 for wiring the switches which are micros. I also saw this page which talks about different code to use - http://www.picaxe.com/Circuit-Creator/Switches/Microswitch/
Very confused...
I added a picture of the prop - maybe it will help understand what I'm doing
Thanks so much for the help!
All in all, the code seems to work for me, that is until I inserted “if __then” statements. The main body will still work, but the switches has no influence on the code.
Here is the lay out:
C.4 will be connected to the main start button. So, I want the system to be dead until that button is pressed. I believe I currently have the pin pulled low until the button is hit.
Currently when I turn on power, the prop will begin to run. The switch has no effect.
Secondly the dump rod does not run at all.
What I need to happen is that a second switch will be triggered to turn off the dump rod.
That switch will be connected to C.3.
Again, currently pulled low.
I used the diagram in Manual 3 for wiring the switches which are micros. I also saw this page which talks about different code to use - http://www.picaxe.com/Circuit-Creator/Switches/Microswitch/
Very confused...
I added a picture of the prop - maybe it will help understand what I'm doing
Thanks so much for the help!
Code:
[color=Navy]#picaxe [/color][color=Black]14m2[/color]
[color=Blue]symbol sugar [/color][color=DarkCyan]= [/color][color=Blue]b.1
symbol stripes [/color][color=DarkCyan]= [/color][color=Blue]b.2
symbol gears [/color][color=DarkCyan]= [/color][color=Blue]b.3
symbol pump [/color][color=DarkCyan]= [/color][color=Blue]b.4
symbol rod [/color][color=DarkCyan]= [/color][color=Blue]b.5
servo b.1[/color][color=Black], [/color][color=Navy]150[/color]
[color=Blue]servo b.2[/color][color=Black], [/color][color=Navy]150[/color]
[color=Blue]servo b.3[/color][color=Black], [/color][color=Navy]150[/color]
[color=Blue]servo b.4[/color][color=Black], [/color][color=Navy]149[/color]
[color=Blue]servo b.5[/color][color=Black], [/color][color=Navy]150[/color]
[color=Blue]input[/color][color=Black]: [/color][color=Blue]c.4 [/color][color=DarkCyan]= [/color][color=Navy]0[/color]
[color=Blue]input[/color][color=Black]: [/color][color=Blue]c.4 [/color][color=DarkCyan]= [/color][color=Navy]0[/color]
[color=Black]main:[/color]
[color=Blue]if [/color][color=Purple]b4 [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then start1: [/color][color=Green]'starting switch pushed[/color]
[color=Blue]start1: [/color][color=Green]'main program[/color]
[color=Blue]servopos sugar[/color][color=Black], [/color][color=Navy]150 [/color][color=Green]'left elf dump sequence[/color]
[color=Blue]pause [/color][color=Navy]1000[/color]
[color=Blue]servopos sugar[/color][color=Black], [/color][color=Navy]70[/color]
[color=Blue]pause [/color][color=Navy]2000[/color]
[color=Blue]servopos sugar[/color][color=Black], [/color][color=Navy]150[/color]
[color=Blue]pause [/color][color=Navy]2000[/color]
[color=Blue]servopos sugar[/color][color=Black], [/color][color=Navy]70[/color]
[color=Blue]pause [/color][color=Navy]1000[/color]
[color=Blue]servopos sugar[/color][color=Black], [/color][color=Navy]150[/color]
[color=Blue]pause [/color][color=Navy]3000[/color]
[color=Blue]servopos stripes[/color][color=Black], [/color][color=Navy]150 [/color][color=Green]'right elf dump sequece[/color]
[color=Blue]pause [/color][color=Navy]1000[/color]
[color=Blue]servopos stripes[/color][color=Black], [/color][color=Navy]70[/color]
[color=Blue]pause [/color][color=Navy]2000[/color]
[color=Blue]servopos stripes[/color][color=Black], [/color][color=Navy]150[/color]
[color=Blue]pause [/color][color=Navy]2000[/color]
[color=Blue]servopos stripes[/color][color=Black], [/color][color=Navy]70[/color]
[color=Blue]pause [/color][color=Navy]1000[/color]
[color=Blue]servopos stripes[/color][color=Black], [/color][color=Navy]150[/color]
[color=Blue]pause [/color][color=Navy]3000[/color]
[color=Blue]servopos gears[/color][color=Black], [/color][color=Navy]155 [/color][color=Green]'start up gears [/color]
[color=Blue]servopos pump[/color][color=Black], [/color][color=Navy]156 [/color][color=Green]'start up pump[/color]
[color=Blue]pause [/color][color=Navy]5000[/color]
[color=Blue]servopos rod[/color][color=Black], [/color][color=Navy]75 [/color][color=Green]'start up drop rod[/color]
[color=Blue]if [/color][color=Purple]b3 [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then start2: [/color][color=Green]'if microswitch tripped, stop drop rod[/color]
[color=Blue]start2:
servopos rod[/color][color=Black], [/color][color=Navy]150 [/color][color=Green]'drop rod stopped[/color]
[color=Blue]goto [/color][color=Black]main [/color][color=Green]'hold till button pressed[/color]
Attachments
-
976.1 KB Views: 10