Dead Person Switch
The Assignment⌗
For this assignment, we were asked to 1. make an ATtiny85 programming jig, 2. create an interaction/project with the ATtiny85, along with any sensor and/or output you choose.
I decided to make a simple “Dead Person’s Switch” (dead man’s switch). Two momentary push buttons need to be pressed at the same time in order for an LED to turn on.
Building⌗
Programming Jig⌗
Following the instructions provided to us (programming an ATtiny85), I created the programming jig. The jig is intedned to be used by pluggiing it into an Arduino UNO. The Arduino UNO acts as a programmer for the ATtiny85.
Breadboard⌗
Code⌗
The code on the ATtiny85.
const int leftButtonPin = 3;
const int rightButtonPin = 4;
const int ledPin = 1;
int leftButtonState = 0;
int rightButtonState = 0;
void setup() {
pinMode(leftButtonPin, INPUT);
pinMode(rightButtonPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
leftButtonState = digitalRead(leftButtonPin);
rightButtonState = digitalRead(rightButtonPin);
if (leftButtonState == HIGH && rightButtonState == HIGH) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}