Download presentation
Presentation is loading. Please wait.
1
using the Arduino to make LEDs flash
2
DISCLAIMER & USAGE The content of this presentation is for informational purposes only and is intended only for students attending Louisiana Tech University. The author of this information does not make any claims as to the validity or accuracy of the information or methods presented. Any procedures demonstrated here are potentially dangerous and could result in injury or damage. Louisiana Tech University and the State of Louisiana, their officers, employees, agents or volunteers, are not liable or responsible for any injuries, illness, damage or losses which may result from your using the materials or ideas, or from your performing the experiments or procedures depicted in this presentation. If you do not agree, then do not view this content. The copyright label, the Louisiana Tech logo, and the “living with the lab” identifier should not be removed from this presentation. You may modify this work for your own purposes as long as attribution is clearly provided.
3
1. plug in Arduino 2. we will be using digital pin 2 as an output to make an LED go on and off
14 digital I/O pins (I/O = input / output) connect computer to USB plug
4
the circuit 470W digital I/O pin 2 digital pin 0
5
enter and run the following sketch
void setup() { // initialize the digital pin 2 as an output pinMode(2, OUTPUT); } void loop() { digitalWrite(2, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(2, LOW); // set the LED off delay(500); // wait for 500 ms
6
how the sketch works infinite loop HIGH = 5V and LOW = 0V (Always!!!!)
void setup() { pinMode(2, OUTPUT); } void loop() { digitalWrite(2, HIGH); delay(1000); digitalWrite(2, LOW); delay(500); initialize pin 0 as an output infinite loop set pin 0 to LOW (0V) wait 500 ms set pin 0 to HIGH (5V) wait 1000 ms HIGH = 5V and LOW = 0V (Always!!!!) time (ms) voltage (V) 0V 5V 500 ms 1000 ms
7
now experiment on your own!
Try changing the time to 1.5 seconds on and 1 second off Connect the resistor to digital pin 5 and change the program to match Blink out SOS in Morse code (dot-dot-dot-dash-dash-dash-dot-dot-dot) three short pulses (0.25 seconds each) followed by . . . three long pulses (0.75 second each) followed by . . . a brief pause (1 second) repeat a through d using an infinite loop
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.