Add a TENS unit to the Operation boardgame!
I decided to make my Operation game a little more exciting/terrifying, pick your own adjective, by having it shock me when I mess up. Gotta keep quarantine interesting, no?
The build uses:
Here’s a video of me playing and building it:
Here’s the arduino code for your review:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | int progLoop = 1; //progressive counter loop. Also used for standard non prog when at 1
int switchState = 0; //switch read
void setup() {
// put your setup code here, to run once:
//Serial.begin(9600); //setup the serial port so we can monitor it while testing
pinMode(2, INPUT_PULLUP); // switch
pinMode(10, OUTPUT); // relay
pinMode(13, OUTPUT); // led
}
void loop() {
int sensorValue = analogRead(A0); //read analog sensor(checking if there is voltage coming from the game.
switchState = digitalRead(2); //read the pin that the switch is on.
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0); //voltage read. It is two AA batteries so 3V max
//Serial.println(voltage); //debug output of serial info for testing
if (switchState == LOW) {
progLoop = 1; //reset this so you don't get wammied once moving the switch LOL
}
if (voltage > 2) {
//voltage is coming from the game, so enable the led and relay
digitalWrite(10, HIGH);
digitalWrite(13, HIGH);
delay(200 * progLoop); //how long does it sleep - how long are you shocked. AKA enable tens unit, then sleep for as long as you shoul dbe shocked.
if (switchState == HIGH) {
progLoop = progLoop + 1; //if the progressive switch is on, then keep incrementing it each time the game buzzes
}
} else {
//no voltage, so turn the LED/relay off
digitalWrite(10, LOW);
digitalWrite(13, LOW);
}
} |

