Shop OBEX P1 Docs P2 Docs Learn Events
how do I write this code? — Parallax Forums

how do I write this code?

bobsmithbobsmith Posts: 36
edited 2004-09-26 01:07 in BASIC Stamp
I want to write code for a paintball gun and have no clue how to do it..

Also ill be usin a bs2

Basically what I want it to say is:

' When powered up it is ready with these instructions:

Main:
' Have pin 5 activated because its the led light and has to be on at all times when powered up

If in0 = 1 then 'in0 = trigger
High 1 ' activated solenoid
Pause 10
Low 1 'deactivates solenoid
Pause 40
Goto main

' At any point in the main code if the pin 0 is held in/activated for 2 seconds it goes into mode1

Var mode1 byte

Mode1:
' When in mode1 also have pin 5 activated because it the led light

' This mode has beam break eyes (emitter and detector)(emitter = pin 2, detector = pint 3), when the beam is broking it lets readyloop know its okay to fire. If beam isn't broken then it can't fire and that loops

'This mode is the same as firing mode but has debounce 0

'Mode1 also has to say if the pushbutton in pin 4 is pressed at anytime it goes into MAIN code

End mode1

' At anytime if the pushbutton in pin 4 is pressed at anytime it goes into MAIN code
Sign In or Register to comment.