Unusual Switch

This week, our assignment was to make an unusual switch that works without using our hands. For my project, I decided to make 2 switches that will turn on when the copper strip attached on the ground and the strip attached to your shoe touch (these are connected to the circuit via long wires). When they touch, the LED lights on either side will light up! So if you use your left foot, the yellow LED on the left will light up. If you use your right, the blue one on the right will light up.

I tried to make my circuit as neat as possible, so I organized my wires by color. Red ones are for power, black for GND, green for the left side, blue for the right. As for the longer wires, the ones connected to the strip on the ground are yellow, and the ones connected to your shoe are white. 

Here’s the code:

Basically, if the switch is on, the led will light up. If its not on (the strip in the floor and the shoe aren’t touching) the LED will turn off.

//R = right side, L= left side.

const int ledpinR = 2;
const int ledpinL = 3;

const int switchpinR = 4;
const int switchpinL = 5;

bool switchreadR;
bool switchreadL;

void setup() {
  // put your setup code here, to run once:
  pinMode(ledpinR, OUTPUT);
  pinMode(ledpinL, OUTPUT);

  pinMode(switchpinR, INPUT);
  pinMode(switchpinL, INPUT);

}

void loop() {
  // right LED code:
  
  switchreadR = digitalRead(switchpinR);

  if (switchreadR == true) {

    digitalWrite(ledpinR , HIGH );
  } else {
    digitalWrite(ledpinR , LOW);
  }

// left LED code:
  switchreadL = digitalRead(switchpinL);

  if (switchreadL == true) {

    digitalWrite(ledpinL , HIGH );
  } else {
    digitalWrite(ledpinL , LOW);
  }
}

Images:

The circuit
The bottom of the shoe

 

Video:

https://youtube.com/shorts/rRdpnEHXotk?feature=share

Leave a Reply