Arduino programming is typically done in **C++**, but it's simplified through the Arduino IDE (Integrated Development Environment). The code you write for Arduino is called a **sketch**, and it has two main functions:
1. **setup()** β This runs once when the board is powered on or reset. You use it to set up initial settings, like pin modes or serial communication.
2. **loop()** β This runs repeatedly after setup() finishes, allowing you to continuously control the behavior of your hardware.
Even though it's based on C++, the Arduino language hides a lot of the complexity, so you donβt need to worry about memory management or lower-level programming details. Itβs designed to be beginner-friendly, especially for those new to electronics and programming.
Here's a simple example to blink an LED:
```cpp
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Set the built-in LED pin as an output
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED on
delay(1000); // Wait for 1 second
digitalWrite(LED_BUILTIN, LOW); // Turn the LED off
delay(1000); // Wait for 1 second
}
```
This basic structure lets you do a lot with minimal coding!