This tutorial is for helping you learn controlling things through your computer using Arduino.
All you need to have is:-
(Hardware)
1 Arduino or any other arduino clone board
6 LEDs
Some connecting wires
(Software)
Arduino Ide (You can download from dis link-
www.arduino.cc)
If you can use a Blink_Program then you are ready start.
You can learn more about arduino here -
www.arduino.cc
Setup your hardware as shown in this picture
Now Upload this code to your board.
Copy this and paste on ide then upload to you board
//www.rishabhsinhaofficial.weebly.com
// www.rishabhsinha199.blogspot.com
#define led 11
#define led2 10
#define led3 9
#define led4 6
#define led5 5
#define led6 3
int incomingByte = 0;
void setup() {
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT); // set pins at output
Serial.begin(9600);
Serial.print("a = Start Formation");
Serial.print("s = Start Reverse Formation");
Serial.print("d = Stop Formation");
}
void loop() {
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
}
switch(incomingByte)
{
case 'a':
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led4, HIGH);
delay(100);
digitalWrite(led5, HIGH);
delay(100);
digitalWrite(led6, HIGH);
delay(100);
Serial.println("Formation Done");
incomingByte='*';
break;
case 's':
digitalWrite(led6, HIGH);
delay(100);
digitalWrite(led5, HIGH);
delay(100);
digitalWrite(led4, HIGH);
delay(100);
digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led, HIGH);
delay(100);
Serial.println("Reversed Formation Done");
incomingByte='*';
break;
case 'd':
digitalWrite(led6, LOW);
digitalWrite(led5, LOW);
digitalWrite(led4, LOW);
digitalWrite(led3, LOW);
digitalWrite(led2, LOW);
digitalWrite(led, LOW);
Serial.println("LED are now off");
incomingByte='*';
//feel free to upgrade this code
break;
}
}
After uploading go to Tools> Serial Monitor
Now, try sending 'a' as message to the board and see what happens to the led
then send 'd' & 's'.
And observes the outcome on bot hardware and on serial monitor.
Hope you found this instructables helpful!! If you have any questions/suggestions feel free to contact @
youngscientist.rishabh@gmail.com
Find more on www.rishabhsinhaofficial.weebly.com
Thank You!!