Difference between revisions of "Blinking led; Arduino"
From cod3v
(→Theory) |
(→Theory) |
||
Line 19: | Line 19: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The commands pinMode configures the specified pin to behave either as an input or an output. This project uses it as an output. The LED_BUILTIN is pin number 13 | The commands pinMode configures the specified pin to behave either as an input or an output. This project uses it as an output. The LED_BUILTIN is pin number 13. | ||
== Exercises == | == Exercises == |
Latest revision as of 09:46, 26 November 2022
Introduction
The simplest possible LED system because this uses the Arduino UNO onboard LED at pin LED_BUILTIN.
Theory
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
The commands pinMode configures the specified pin to behave either as an input or an output. This project uses it as an output. The LED_BUILTIN is pin number 13.
Exercises
- Use LEDs connected to other pins; perhaps you should use breadboard and current resisting resistor.
- Create Morse coded text.
- Create a metronome that blinks eg. 80 bpm.
- Blink according to a rhythm.