Bird
Raised Fist0
Arduinoprogramming~10 mins

What is Arduino - Visual Explanation

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Concept Flow - What is Arduino
Start: Learn about Arduino
Arduino is a small computer
It can read sensors
It can control lights, motors
You write code to tell it what to do
Upload code to Arduino board
Arduino runs your code
See results in real world
End
This flow shows how Arduino works: you write code, upload it to the board, and it controls real-world devices.
Execution Sample
Arduino
void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}
This code turns an LED on pin 13 on and off every second repeatedly.
Execution Table
StepActionPin 13 StateDelay (ms)Output
1Setup: Set pin 13 as outputLOW (default)0Ready to control LED
2Loop start: Turn LED ONHIGH0LED lights up
3Wait 1000 msHIGH1000LED stays ON
4Turn LED OFFLOW0LED turns off
5Wait 1000 msLOW1000LED stays OFF
6Loop repeats from step 2LOW0Cycle continues
7Exit--Never (runs forever)
💡 Arduino loop runs forever until powered off
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5After Step 6
Pin 13 StateLOWHIGHHIGHLOWLOWLOW
Delay001000010000
Key Moments - 2 Insights
Why does the LED keep blinking forever?
Because the loop() function runs repeatedly without stopping, as shown in execution_table rows 2 to 6.
What does pinMode(13, OUTPUT) do in setup()?
It tells Arduino that pin 13 will send signals out to control devices like an LED, as seen in execution_table step 1.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the state of pin 13 at step 4?
AHIGH
BUndefined
CLOW
DFlashing
💡 Hint
Check the 'Pin 13 State' column at step 4 in execution_table.
At which step does the Arduino wait for 1000 milliseconds for the first time?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
Look at the 'Delay (ms)' column in execution_table to find the first 1000 ms delay.
If you remove the delay(1000) after turning the LED ON, what happens to the LED blinking?
ALED blinks faster without delay
BLED stays OFF constantly
CLED stays ON constantly
DLED stops blinking
💡 Hint
Think about how delay controls the timing shown in variable_tracker Delay values.
Concept Snapshot
Arduino is a small computer board.
You write code in setup() and loop() functions.
setup() runs once to prepare pins.
loop() runs forever to control devices.
Use pinMode() to set pin direction.
Use digitalWrite() to turn devices ON or OFF.
Full Transcript
Arduino is a small computer board you can program to control things like lights and motors. You write code in two main parts: setup() runs once to prepare the board, and loop() runs repeatedly to keep things working. For example, you set pin 13 as output to control an LED. Then in loop(), you turn the LED on, wait one second, turn it off, and wait again. This cycle repeats forever, making the LED blink. The execution table shows each step: setting pin mode, turning LED on and off, and delays. Variables like pin state and delay time change as the program runs. This simple example helps you see how Arduino runs your code to interact with the real world.

Practice

(1/5)
1. What is Arduino primarily used for?
easy
A. Designing websites
B. Writing complex desktop applications
C. Making electronic projects with simple programming
D. Editing videos

Solution

  1. Step 1: Understand Arduino's purpose

    Arduino is a small computer board designed to help create electronic projects.
  2. Step 2: Compare options with Arduino's use

    Only Making electronic projects with simple programming matches Arduino's use for simple programming and electronics.
  3. Final Answer:

    Making electronic projects with simple programming -> Option C
  4. Quick Check:

    Arduino = electronic projects [OK]
Hint: Arduino is for electronics, not software or media [OK]
Common Mistakes:
  • Thinking Arduino is for web design
  • Confusing Arduino with PC software
  • Assuming Arduino edits videos
2. Which of these is the correct basic structure of an Arduino program?
easy
A. setup() and loop() functions
B. main() and run() functions
C. start() and repeat() functions
D. init() and execute() functions

Solution

  1. Step 1: Recall Arduino program structure

    Arduino programs always have setup() to initialize and loop() to repeat actions.
  2. Step 2: Match options to Arduino syntax

    Only setup() and loop() functions uses setup() and loop(), the standard Arduino functions.
  3. Final Answer:

    setup() and loop() functions -> Option A
  4. Quick Check:

    Arduino uses setup() and loop() [OK]
Hint: Remember Arduino always needs setup() and loop() [OK]
Common Mistakes:
  • Using main() like in C programs
  • Confusing function names
  • Assuming start() or init() are Arduino functions
3. What will this Arduino code do?
void setup() {
  pinMode(13, OUTPUT);
}
void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}
medium
A. Cause an error because delay() is not allowed
B. Keep the LED on pin 13 always off
C. Make the LED blink very fast
D. Turn an LED on pin 13 on and off every second

Solution

  1. Step 1: Analyze setup() function

    pinMode(13, OUTPUT) sets pin 13 as output to control an LED.
  2. Step 2: Analyze loop() function

    digitalWrite(13, HIGH) turns LED on, delay(1000) waits 1 second, then LOW turns LED off, delay(1000) waits again.
  3. Final Answer:

    Turn an LED on pin 13 on and off every second -> Option D
  4. Quick Check:

    LED blinks every 1 second [OK]
Hint: delay(1000) means 1 second pause [OK]
Common Mistakes:
  • Thinking delay() causes error
  • Assuming LED stays always on
  • Confusing HIGH/LOW signals
4. Find the error in this Arduino code:
void setup() {
  pinMode(13, OUTPUT);
}
void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000)
}
medium
A. delay() function is not defined
B. Missing semicolon after delay(1000) in loop()
C. digitalWrite cannot use pin 13
D. pinMode should be in loop() not setup()

Solution

  1. Step 1: Check syntax line by line

    All lines end with semicolons except delay(1000) missing one in loop().
  2. Step 2: Validate other statements

    pinMode in setup() is correct; digitalWrite on pin 13 is allowed; delay() is built-in.
  3. Final Answer:

    Missing semicolon after delay(1000) in loop() -> Option B
  4. Quick Check:

    Missing semicolon causes syntax error [OK]
Hint: Check every line ends with a semicolon [OK]
Common Mistakes:
  • Putting pinMode in loop()
  • Thinking pin 13 is invalid
  • Assuming delay() is undefined
5. You want to make a simple Arduino project that turns on an LED only when a button is pressed. Which of these code snippets correctly sets up the button and LED pins?
hard
A. void setup() { pinMode(2, INPUT); pinMode(13, OUTPUT); }
B. void setup() { pinMode(13, INPUT); pinMode(2, OUTPUT); }
C. void setup() { pinMode(2, OUTPUT); pinMode(13, INPUT); }
D. void setup() { pinMode(13, OUTPUT); pinMode(13, INPUT); }

Solution

  1. Step 1: Identify button and LED pins

    Button should be input (pin 2), LED should be output (pin 13).
  2. Step 2: Check pinMode assignments

    void setup() { pinMode(2, INPUT); pinMode(13, OUTPUT); } sets pin 2 as INPUT and pin 13 as OUTPUT, which is correct.
  3. Final Answer:

    void setup() { pinMode(2, INPUT); pinMode(13, OUTPUT); } -> Option A
  4. Quick Check:

    Button=INPUT, LED=OUTPUT [OK]
Hint: Button pin is INPUT, LED pin is OUTPUT [OK]
Common Mistakes:
  • Swapping input/output pins
  • Setting same pin twice
  • Using wrong pin numbers