Maddy
Published © GPL3+

Ceci N'est Pas Une Ampoule [This Is Not a Lightbulb]

It's not a light bulb, it's three LEDs attached to what (sort of) looks like a light bulb. All controlled by a mini-touch kit.

BeginnerShowcase (no instructions)1 hour5,220

Things used in this project

Story

Read more

Schematics

Lightbulb Schematic

The questionmarked box is a stand in for the touch sensor

Code

Code for touch light toggle

Arduino
//Maddy McGee
int light;
int sensor;
int lastVal;
boolean on;

void setup(){
  light = 2;
  sensor = 14;
  Serial.begin(9600);
  Serial.println("Start");
  pinMode(light,OUTPUT);
  pinMode(sensor,INPUT);
  lastVal = 0;
  on = false;
}

void loop(){
  int val = digitalRead(sensor);
  if(lastVal==0 && val==1)
    on= !on;
  if(on)
    digitalWrite(light,HIGH);
   else
    digitalWrite(light,LOW);
  Serial.println(val);
  lastVal = val;
}

Credits

Maddy

Maddy

3 projects • 57 followers
Computer Science Engineering second year at The Ohio State University, in love with code and electronics.

Comments