0% found this document useful (0 votes)
3 views

arduino led blink code

The document provides a tutorial for a simple Arduino project called 'Blink', which turns an LED on and off every second. It details the hardware required, including an Arduino board and an optional external LED with a resistor, and explains how to connect and control the built-in LED using the LED_BUILTIN constant. The document also includes information on resistor values for safe operation and links to additional resources for learning Arduino programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
3 views

arduino led blink code

The document provides a tutorial for a simple Arduino project called 'Blink', which turns an LED on and off every second. It details the hardware required, including an Arduino board and an optional external LED with a resistor, and explains how to connect and control the built-in LED using the LED_BUILTIN constant. The document also includes information on resistor values for safe operation and links to additional resources for learning Arduino programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
Q cee Home / Programming J Builtin Examples 1 blink Blink “Turn an LED on and off every second Last revision 02/10/2024 This example shows the simplest thing you can do with an Arduino to see physical output: i links the on- board LED. Hardware Required ‘Arduino Board optional LED 220 ohm resistor ‘This example uses the built-in LED that most Arduino boards have, This LED is connected to a digital pin and its number may vary from board type to board type. To make your life easier, we have a constant that is specified in every board descriptor file, This constant is LED BUILTIN and allows you to control the bulltin LED easily. Here is the correspondence between the constant and the digital pin. 013-101 013 -Due D1 -Gemma 013 -Intel Edison 013 -Intel Galileo Gen2 013 -Leonardo and Micro 013 -LilyPad 13 -LilyPad USB 013 -Mini 26 - MKR1000 013-Nano 013-Pro 013-Pro Mini 013-UNO 013 -Yun D13-Zero Ifyou want to light an external LED with this sketch, you need to build ‘tis circuit, where you connect one end of the resistor to the digital pin correspondent to the LED_BUILTIN constant, Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the GND. In the diagram below we show an UNO board that < Reras Weis Barat cate ceurarer Fe Fae aR EAON CoE TITERS COTE or CO ‘The resistor is essential for safe operation as it limits the current flowing through the LED, preventing damage to both the LED and the Arduino’s output pin, You can choose the resistor value based on the desired current using Ohm's Law (V= IR) where V is the voltage of your board (SV or 3.3V) minus the forward voltage for the LED you are using (typical for red would be 1.8 to 2.2 volts) In this case, using 2 220-ohm resistor with an Arduino UNO R3 (2 5V board) limits the current to a safe level for both the LED and the Arduino pin. Adjusting the resistor value allows you to control the LED's brightness while ensuring safe operation. For SV boards you can expect the LED to be visible toa resistor value of up to 1K Ohm. arr Coe ET sare Schematic ore IF STR CORR oar Aca CTOTATA RGEC CES TA HATTA BIN SAA, TATRA HH OMT (orRBY oF aH sas Towa corelE Net SHA OTM AAG TL TRA / Bw RA/ 01 CRSFPR / rH COTS ferme sean ora! eS eee = FF oes LeD_BUILTIN raf eras war pinNode(LED-AUILTIN, OUTPUT): Sse SEY, eM RATE Pc IARI OL SrA digitalWrite(LED-BUILTIN, HIGH); BE GARG CTATG 5 COPE FATES wal of Ria Prat are af corebrura ner Cola Bra ee AB ITSS Sea) CATA STA TEATS Frca af 4 Sar: digitalWrite(LED_BUILTIN, LOW) 9f6 LeD_BUILTIN Praféte 0 Conet Feften Fen ar aa ee eh CH FDL ae THT ACT, TAA HTS ofea THE Crera OAT ones AE, OR SATOH! cane 1000 AFOTES a ae CHTSA UT SRE SAS THA OT TT SHTEHS WET TAR, OF OPE ATT AT wa FORE aT cewara CHT sri Creer cars rare delay() | delay() SETA SI SATE FATS PTR, TCG FIC HES CHAS BPE Fors TET Freee Foferbrafrotrfermcera Gareate ore 1. u 2 i Blink Turns an LED on for one second, then off for one second, repeatedly. Wost Arduinos have an on-board LED you can! control. On the UN, MEGA and ZERO at is attached to digital pin 73. fon MKRI@00 on pin 6, LED_BUILTIN as, the correct LED pin independent of hich board is used If you want to know what pin the on-board LED is connected to on your Arduino model, check the Technical Specs of your board at hetps://amw-arduino icc/en/Main/Product rarzgeraie See Also Learn more You can find more basic tutorials in the built-in examples section You can also explore the language reference, a detailed collection of the Arduino programming language. Last revision 2015/07/28 by SM Suggest Need License changes support? — the sauino Thecoment Help Center SoCUmeation on othe letcanced docs arin ude the oes MAURO cents facitatea Forum ommons through Discover AStbutton pubic Arduino -—=—‘Sharelke 40 ius Discord Heenss comm anything wrong you canal the page here. Was this article helpful? o Dp Tes rsenice Pehacy Poly —Seaurty Cookie Settings

You might also like