This is the basic mine program. The switch for the mine is a circular wire mounted on the outside of the JackBord. This wire represents one half of the switch the other half of the switch is the case of the JackBord itself. Thus to close the switch, or press the button, the wire comes into contact with the case of the JackBord this is what triggers the mine.
When triggered the mine program will display a message and it will also tell you the number of times that it has been triggered. Once triggered 10 or 11 times the program will exit.
Program
---
Basic Mine Program
The switch for the mine is connected to the JackBords
port A pins 5 and ground.
When triggered the mine will tell you.
---
prog_vars =
d/count 0
d/boom 0
d/triggers 0
prog_vars.
prog_start =
print "Mine Start"
-- Setup the trigger for pin A5
btp a5 d1 1|/boom 1|"BOOM!"
-- Turn D1 off
d1 0
prog_start.
prog_loop =
-- main program loop
-- Check if mine triggered.
any /boom = 1 ->
-- YES triggered
inc /triggers
print "Count /count TRIG no /triggers BOOM /boom"
-- Reset
/boom 0
--clear d1
d1 0
enda.
-- Exit after 10 triggers.
any /triggers > 10 -> exitprog
inc /count
prog_loop.
prog_stop =
print "Bye"
-- clear the buttons
rstb
prog_stop.