help edit this code?
bobsmith
Posts: 36
I have no clue what I am doing but i have tried to attempt to write some code.
I am making a board for a paintball gun.· the board has 4 modes and each time the pushbutton is pressed it goes to the mode after it
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
EYEOFF:
IR_DETECT VAR BIT
LOW 7
LOOP:
·PAUSE 50
·FREQOUT 7, 1, 38500
·IR_DETECT = IN8
·IF IR_DETECT = 0 THEN UNBROKEN
··GOTO LOOP
·UNBROKEN:
IF IR_DETECT = UNBROKEN THEN
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
END
EYEON:
IR_DETECT VAR BIT
LOW 7
LOOP:
·PAUSE 50
·FREQOUT 7, 1, 38500
·IR_DETECT = IN8
·IF IR_DETECT = 1 THEN BROKEN
··GOTO LOOP
·BROKEN:
IF IR_DETECT = BROKEN THEN
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
END
CEYEOFF:
IR_DETECT VAR BIT
LOW 7
LOOP:
·PAUSE 50
·FREQOUT 7, 1, 38500
·IR_DETECT = IN8
·IF IR_DETECT = 0 THEN UNBROKEN
··GOTO LOOP
·UNBROKEN:
IF IR_DETECT = UNBROKEN THEN
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
END
CEYEON:
IR_DETECT VAR BIT
LOW 7
LOOP:
·PAUSE 50
·FREQOUT 7, 1, 38500
·IR_DETECT = IN8
·IF IR_DETECT = 1 THEN BROKEN
··GOTO LOOP
·BROKEN:
IF IR_DETECT = BROKEN THEN
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
END
BUTTON Btn, 0, 200, 20, btnWrk, 0, EYEOFF
BUTTON Btn, 0, 200, 20, btnWrk, 0, EYEON
BUTTON Btn, 0, 200, 20, btnWrk, 0, CEYEOFF
BUTTON Btn, 0, 200, 20, btnWrk, 0, CEYEON
I am making a board for a paintball gun.· the board has 4 modes and each time the pushbutton is pressed it goes to the mode after it
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
EYEOFF:
IR_DETECT VAR BIT
LOW 7
LOOP:
·PAUSE 50
·FREQOUT 7, 1, 38500
·IR_DETECT = IN8
·IF IR_DETECT = 0 THEN UNBROKEN
··GOTO LOOP
·UNBROKEN:
IF IR_DETECT = UNBROKEN THEN
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
END
EYEON:
IR_DETECT VAR BIT
LOW 7
LOOP:
·PAUSE 50
·FREQOUT 7, 1, 38500
·IR_DETECT = IN8
·IF IR_DETECT = 1 THEN BROKEN
··GOTO LOOP
·BROKEN:
IF IR_DETECT = BROKEN THEN
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
END
CEYEOFF:
IR_DETECT VAR BIT
LOW 7
LOOP:
·PAUSE 50
·FREQOUT 7, 1, 38500
·IR_DETECT = IN8
·IF IR_DETECT = 0 THEN UNBROKEN
··GOTO LOOP
·UNBROKEN:
IF IR_DETECT = UNBROKEN THEN
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
END
CEYEON:
IR_DETECT VAR BIT
LOW 7
LOOP:
·PAUSE 50
·FREQOUT 7, 1, 38500
·IR_DETECT = IN8
·IF IR_DETECT = 1 THEN BROKEN
··GOTO LOOP
·BROKEN:
IF IR_DETECT = BROKEN THEN
DIRS=11001011···························· 'Input/Output
PINS=10000011···························· 'Low/High
SYMBOL Trigger=PIN0······················ 'INPUT
SYMBOL Emitter=PIN1······················ 'OUTPUT
SYMBOL Detector=PIN2····················· 'INPUT
SYMBOL Solenoid=PIN3····················· 'OUTPUT
SYMBOL Dwell=B4
SYMBOL Drop=B5
LET dwell=20····························· 'ms
LET drop=20······························ 'ms
ReadyLOOP:
BUTTON 0,1,255,0,B1,0,ReadyLOOP
HIGH 3··································· 'Activates Solenoid
PAUSE Dwell
LOW 3···································· 'Deactivates Solenoid
PAUSE Drop
GOTO ReadyLOOP
END
BUTTON Btn, 0, 200, 20, btnWrk, 0, EYEOFF
BUTTON Btn, 0, 200, 20, btnWrk, 0, EYEON
BUTTON Btn, 0, 200, 20, btnWrk, 0, CEYEOFF
BUTTON Btn, 0, 200, 20, btnWrk, 0, CEYEON
Comments
Did you try to run this code in the Basic Stamp debugger? If not then try it !!
That will make things a lot esyer for us to help you.
Klaus