Blinking LED - the first Arduino sketch
FunduinoPublished on
Der erste Sketch: die Onboard-LED an Pin 13 blinken lassen
You need this
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
11,12 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
1 part for 11,12 € *Ready to ship immediately · Delivery time: 1-3 business days
* All prices include statutory VAT, plus shipping costs.
The setup section: Set pin 13 as an output
The setup section
void setup() // The setup begins here.
{ // A program section begins here.
pinMode(13, OUTPUT); // Pin 13 should be an output.
} // A program section ends here.The loop section: the main program
The loop section
void loop() // This is where the main program begins.
{ // This is where a program block begins.
digitalWrite(13, HIGH); // Turn on the voltage at pin 13 (LED on).
delay(1000); // Wait 1000 milliseconds (one second).
digitalWrite(13, LOW); // Turn off the voltage at pin 13 (LED off).
delay(1000); // Wait 1000 milliseconds (one second).
} // Program block ends.Upload the complete sketch
The complete sketch
void setup() // This is where setup begins.
{ // This is where a section of the program begins.
pinMode(13, OUTPUT); // Pin 13 is set as an output.
} // A section of the program ends here.
void loop() // This is where the main program begins.
{ // This is where a section of the program begins.
digitalWrite(13, HIGH); // Turn on the voltage at pin 13 (LED on).
delay(1000); // Wait 1000 milliseconds (one second).
digitalWrite(13, LOW); // Turn off the voltage at pin 13 (LED off).
delay(1000); // Wait 1000 milliseconds (one second).
} // A section of the program ends.Variation: make the LED blink faster
Variation – blink faster
void setup() // This is where setup begins.
{ // This is where a program section begins.
pinMode(13, OUTPUT); // Set pin 13 as an output.
} // This is where a program section ends.
void loop() // This is where the main program begins.
{ // Program section begins.
digitalWrite(13, HIGH); // Turn on the voltage at pin 13 (LED on).
delay(200); // Wait 200 milliseconds.
digitalWrite(13, LOW); // Turn off the voltage at pin 13 (LED off).
delay(200); // Wait 200 milliseconds.
} // Program section ends.Rate the instructions