A basic example of turning the built-in LED on and off on an Arduino microcontroller.
Open up Arduino Create and add the following code:
// The setup function runs once when you press reset or power the board
void setup() {
// Initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// The loop function runs over and over again forever
void loop() {
// Turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
// Turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}You will need to setup the following circuit using your Arduino:
Full tutorial URL:
https://codeadam.ca/learning/arduino-built-in-led.html
- Visual Studio Code (or any code editor)
- Arduino Create
