Devices & Components
Arduino Nano
Resistor 330 ohm
Male/Male Jumper Wires
Switch Sealing Boot, Button Operators
LED (generic)
Hardware & Tools
Hot glue gun (generic)
Solder Wire, Lead Free
Helping Hand Tool, with Magnifying Glass
Soldering iron (generic)
Project description
Code
Code for DIY Ambient Lamp
arduino
1int count=0; 2int newcount; 3void setup() 4 5 6{ 7Serial.begin(9600); 8pinMode(2,INPUT); //push button 9pinMode(13,OUTPUT); //red led 10pinMode(6,OUTPUT); //blue led 11pinMode(12,OUTPUT); // green led 12 13} 14void loop() 15{ 16 17 if(digitalRead(2)==HIGH) 18 { 19 newcount=count+1; 20 if(newcount!=count) 21 { 22 Serial.println(newcount); 23 switch (newcount) 24 { 25 case 1: digitalWrite(13,HIGH); 26 break; 27 28 29 case 2: digitalWrite(13,LOW); 30 break; 31 32 33 case 3: digitalWrite(6,HIGH); 34 break; 35 36 case 4: digitalWrite(6,LOW); 37 break; 38 39 case 5: digitalWrite(12,HIGH); 40 break; 41 42 case 6: digitalWrite(13, HIGH); 43 digitalWrite(6, HIGH); 44 digitalWrite(12, HIGH); 45 break; 46 47 48 49 50 default: digitalWrite(13,LOW); 51 digitalWrite(6,LOW); 52 digitalWrite(12,LOW); 53 54 newcount=0; 55 break; 56 } 57 count=newcount; 58 } 59} 60delay(130); 61}
Downloadable files
Schematics for Ambient Lamp
Schematic plan showing how the leds, button and other components are connected to the arduino.
Schematics for Ambient Lamp
Schematics for Neon Lamp
Connection Plan for Reference
Schematics for Neon Lamp

Comments
Only logged in users can leave comments