Getting started
Your first steps: tools, a first blink and what to try next.
What you need
- A board, such as an Arduino Uno or an ESP32 development board
- A USB cable that carries data, not only power
- A computer with the free Arduino IDE installed
Your first sketch: blink
Most boards have a small LED built in. This sketch turns it on and off every second.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // LED on
delay(1000); // wait one second
digitalWrite(LED_BUILTIN, LOW); // LED off
delay(1000);
}Steps
- Plug the board into your computer with the USB cable.
- Open the Arduino IDE and choose your board and port from the Tools menu. For an ESP32, first add its board package.
- Paste in the sketch (the IDE also has a Blink example under File, Examples, Basics).
- Press Upload and watch the LED blink.
Safe next steps
- Add an external LED, always with a resistor in series.
- Read a button with
digitalRead(). - Stay with low-voltage, battery or USB power. Do not connect a board to mains electricity.
- Check voltage: 5 volts on an Uno, 3.3 volts on an ESP32.
- Change one thing at a time, so you know what caused any problem.