arduino Getting started with arduino Bare Minimum

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Here's the 'bare minimum' Arduino sketch. This can be loaded into the Arduino IDE by choosing File > Examples > 01. Basics > Bare Minimum.

void setup() {
  // put your setup code here, to run once
}

void loop() {
  // put your main code here, to run repeatedly
}

Code in the setup() function will be run once when the program starts. This is useful to set up I/O pins, initialize variables, etc. Code in the loop() function will be run repeatedly until the Arduino is switched off or a new program is uploaded. Effectively, the code above looks like this inside the Arduino runtime library:

setup();
while(1) {
  loop();
}

Unlike programs running on your computer, Arduino code can never quit. This is because the microcontroller only has one program loaded into it. If this program quit there would be nothing to tell the microcontroller what to do.



Got any arduino Question?