Arduino Lab 1 0

1,698 views

Published on

Published in: Business, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,698
On SlideShare
0
From Embeds
0
Number of Embeds
1,068
Actions
Shares
0
Downloads
22
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Arduino Lab 1 0

  1. 1. Arduino Lab 1.0 Lab 1.0 - LED Blinking
  2. 2. Setup Arduino programming is like C. It has t wo basic functions. First is setup - this has all commands that are executed only once. void setup (void) { ; }
  3. 3. Loop Second function is loop - This has commands executed in a continius loop. void loop (void) { ; }
  4. 4. 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); }
  5. 5. Predefined Commands Another 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); }
  6. 6. Predefined Command Another command is delay. This provide delay in msecs. void loop (void) { digitalWrite (13,HIGH); delay(500); digitalWrite (13,LOW); delay(500); }
  7. 7. First Program #define LED 13 void setup (void) { pinMode (LED,OUTPUT); } void loop (void) { digitalWrite (LED,HIGH); delay(200); digitalWrite (LED,LOW); delay(200); }
  8. 8. 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.
  9. 9. Next Level Program Modify 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.
  10. 10. Contact Me Have more ideas, queries, suggestions? Contact me at - Vinay Chaddha email : vinay@joy-n-freedom.com SMS : 9811074026

×