Download - Arduino lab 1_0
Arduino Lab 1.0Lab 1.0 - LED Blinking
Material RequiredArduino Board + RS232 Cable + Power Supply
Or
Arduino Mega + USB Cable
Installed Arduino IDE on your computer
Working RS232 or USB port in your computer
SetupArduino programming is like C.
It has two basic functions.
First is setup - this has all commands that are executed only once.
void setup (void){
;}
Loop
Second function is loop - This has commands executed in a continius loop.
void loop (void)
{;
}
Predefined Commands
There are few predefined commands
First command is pinMode. This sets the function of pin as input or output.
Usually this is done in setup function
void setup (void){
pinMode (13,OUTPUT);}
Predefined CommandsAnother is digitalWrite.
This write HIGH or LOW on pins defined as OUTPUT.
This can be executed in setup or loop function
void loop (void){
digitalWrite (13,HIGH);}
Predefined CommandAnother command is delay.
This provide delay in msecs.
void loop (void){digitalWrite (13,HIGH);delay(500);digitalWrite (13,LOW);delay(500);
}
First Program#define LED 13void setup (void){
pinMode (LED,OUTPUT);}void loop (void){
digitalWrite (LED,HIGH);delay(200);digitalWrite (LED,LOW);delay(200);
}
Verify-Upload
Click on VERIFY (Sketch | Verify)
Click on UPLOAD (File | Upload)
Wait - it will start running, LED will start blinking after few seconds.
Change the delay, verify and upload again. See the difference on blinking time and speed.
Next Level ProgramModify the program so that with single LED you create morse code of SOS.
Send me an email giving your experience, total time spent and problems faced in the process.
This is first part of training. You will be getting next level of training soon.
Contact MeHave more ideas, queries, suggestions?
Contact me at -
Vinay Chaddha
email : [email protected]
SMS : 9811074026
know more about me at visualcv.com/gvc3065
Check us online
Join our facebook page at facebook.com/open.embedded
Buy products from myworld.ebay.in/open.embedded