$USD
  • EUR€
  • £GBP
  • $USD
PROJECTS Arduino

Lightbulb? This Is Not a Lightbulb

DFRobot Feb 13 2019 422

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. 



Hardware components

  1. DFRduino UNO R3 - Arduino Compatible   *1
  2. Mini Touch Kit    *1
  3. LED (generic)  *3
These two dimensional fluorescent bulbs are actually three white LEDs. The 'bulb' is a laser cut and engraved piece of acrylic. Stuck to one side of the acrylic is a piece of sticky copper, which is connected to a touch sensor. The light turns on with a simple touch, and off again with another touch. All the electronics are contained in the box base, with a hole for the AB to USB cable to plug into a wall transformer or other USB power source.










Schematics




Code
//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;
}

This project is made by Maddy.

REVIEW