Arduino Masterclass - Lesson 3: How to create Arduino Programs
Learn how Arduino programs work
👋 Welcome to Arduino programming! This lesson will teach you how Arduino programs work. You can apply this to 100% of your programs later.
💡How Arduino Programs Run?
Every Arduino program has two essential functions: setup() runs once when the board starts, and loop() runs continuously forever. Understanding this flow is key to programming Arduino.
Arduino Program Flow
Understanding setup() and loop()
🔧setup() Function
Runs ONCE when Arduino starts or resets. Use it to initialize pins, serial communication, and variables.
🔄loop() Function
Runs CONTINUOUSLY in an infinite loop. This is where your main program logic goes.
🔄Reset Button
Pressing the reset button restarts the Arduino, running setup() again followed by loop().
💡Official Arduino Programming Language Documentation
This is considered the bible for looking up everything about the Arduino programming language. It's organized into three main categories:
| Category | Description |
|---|---|
📐Structure | Program structure including setup(), loop(), and I/O pin control, ... |
⚙️Functions | Built-in functions like digitalWrite(), digitalRead(), delay(), and many more |
📦Variables | Data types, constants, and variable declarations |
📚 The bible can be found here: Arduino Language Reference
💡 Don't be scared! The documentation is very friendly with clear examples and short, easy-to-read explanations.
How to use the documentation:
- You don't need to read everything - use it like a directory. When you're reading a program and unsure about a term, look it up there.
- If you still don't understand something, ask ChatGPT to explain it in simpler terms.
- It's always up-to-date and the only source of truth for accurate and exact Arduino information.