Jackson’s Conductive Fabric Switch

Here is my completed project. I used conductive fabric as a switch that would toggle 2 LEDs on or off depending on whether the circuit was completed. The alligator clips when both connected through the fabric send energy through it which closes the circuit and changes the LED that receives power.




Here is the code I used for the circuit:

const int buttonPin = 3; // button pin
const int ledPin1 = 12; // LED Pin 1
const int ledPin2 = 13; // LED Pin 2

int buttonState = 0; // button status

void setup() {
// LED pins
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
//input pin
pinMode(buttonPin, INPUT);

void loop() {
//button that checks for a conntection and toggles the lights
buttonState = digitalRead(buttonPin);

// checks for a connection between the button switch.
if (buttonState == LOW) {
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, LOW);
} else {
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, HIGH);






Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s