loading

Hello friends I hope you all are interested in making electronic projects. You may be working with simple, basic electronic gadgets. But have you ever heard about “LinkitONE” . Do you know that how advance it is and how helpful it is to make high level projects? Using it commanding gadgets become easy. Today I am going to present a small view of the project which can be done using an LinkitONE as compare to those great projects which can be done using it.

To switch on different colour LEDs as a result of pressing the switch.
Note: - Switch or pushbuttons is a momentary switches that closes a circuit when pressed. They snap into breadboard easily. These are good for detecting on / off signals.
Light Emitting Diodes or LEDs are a type of diode that illuminates when electricity passes through it. Like all diodes electricity only flows in one direction through these components. The anode which typically connects to power, is usually the longer leg , and the cathode is the shorter leg.

Step 1: Tools Required

1. Arduino
2. Breadboard
3. Male jump wires
4. 220 OHM Resistors
5. 10 kiloOHM Resistor
6. Single colour LEDs
7. A switch

Step 2: Programming

int switchState=0; //it initialises the value of switchState as 0
void setup()
{
pinMode(3,OUTPUT); //it defines the digital pin 3 as output
pinMode(4,OUTPUT); //it defines the digital pin 4 as output
pinMode(5,OUTPUT); //it defines the digital pin 5 as output
pinMode(2,OUTPUT); //it defines the digital pin 2 as output
Serial.begin(9600); //it begin serial communication at 9600 bps
}
void loop()
{
switchState=digitalRead(2); //digitalRead checks the chosen pin 2 for voltage
if(switchState==LOW); //it is a conditional statement
{
digitalWrite(3,HIGH); //it is a command which allows you to send 5 volt to pin 3
digitalWrite(4,LOW); //it is a command which allows you to send 0 volt to pin 4
digitalWrite(5,LOW); //it is a command which allows you to send 0 volt to pin 5
}
else
{
digitalWrite(3,LOW); //it is a command which allows you to send 0 volt to pin 3
digitalWrite(4,LOW); //it is a command which allows you to send 0 volt to pin 4
digitalWrite(5,HIGH); //it is a command which allows you to send 0 volt to pin 5
delay(250); //it calls a delay for ¼ of a second
digitalWrite(4,HIGH); //it is a command which allows you to send 5 volt to pin 4
digitalWrite(5,LOW); //it is a command which allows you to send 0 volt to pin 5
delay(250); //it calls a delay for ¼ of a second
}
} // go back to the beginning of the loop

Step 3: Connect - Resistors

Step 1
Take an arduino and connect it with your laptop.
Step 2
Take a breadboard and place a switch on it.
Step 3
Connect one side of its leg with digital pin 2 and ground it with a 10 KiloOHM resistor.
Step 4
Connect 5 volt pin to another side of its leg.

Step 4: Connect - LEDs

Step 5
Place 3 LEDs on the breadboard and connect their long leg with 5 volt.
Step 6
Ground them with the help of 220 OHM resistors.

Step 5: Try It

Now power it up and test it out.

About This Instructable

129views

1favorite

License:

More by ayushagg:Servo Motor with LinkitONE LinkitONE MP3 Player LinkitONE LED Pattern Generation  
Add instructable to: