Core Concepts Interviewers Probe
Interviewers start with fundamentals to gauge whether you understand the platform rather than just copying sketches. Expect to explain that every Arduino sketch has exactly two required functions: setup(), which runs once at boot to initialize pins and peripherals, and loop(), which runs repeatedly forever afterward. You should distinguish digital I/O (HIGH/LOW via digitalRead/digitalWrite) from analog input (analogRead returning 0–1023 through the ADC) and analog output (analogWrite producing PWM, not a true analog voltage). Being able to state that analogWrite is pulse-width modulation, not a DAC, separates candidates who memorize from those who understand.
Cricket analogy: Knowing setup() versus loop() cold is like a batter knowing the difference between the first delivery guard and the repeated between-balls routine — the interviewer tests whether you grasp the innings structure, not just how to swing.
// A frequent interview task: debounce a button correctly with millis()
const uint8_t BUTTON = 2;
unsigned long lastChange = 0;
const unsigned long DEBOUNCE_MS = 50;
int stableState = HIGH; // idles HIGH with INPUT_PULLUP
int lastReading = HIGH;
void setup() {
pinMode(BUTTON, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
int reading = digitalRead(BUTTON);
if (reading != lastReading) lastChange = millis(); // input moved
if (millis() - lastChange > DEBOUNCE_MS) {
if (reading != stableState) {
stableState = reading;
if (stableState == LOW) Serial.println(F("Pressed"));
}
}
lastReading = reading;
}Memory, Timing, and Communication
Mid-level questions test resource awareness. Be ready to describe the three memory types on an AVR Arduino: flash (program storage, non-volatile), SRAM (runtime variables, volatile, tiny — 2 KB on an Uno), and EEPROM (small non-volatile storage for settings, written via the EEPROM library). On timing, explain why delay() is blocking and how millis() enables cooperative multitasking, and know that interrupts via attachInterrupt() let you respond to events without polling — while keeping ISRs short and marking shared variables volatile. On communication, know the three main buses: UART/Serial (asynchronous, two wires TX/RX), I2C/Wire (two wires SDA/SCL, addressable, many devices), and SPI (faster, four wires with a chip-select per device).
Cricket analogy: Naming flash, SRAM, and EEPROM is like knowing the roles of Test, ODI, and T20 formats — each has a distinct purpose, and confusing volatile SRAM with persistent EEPROM is like expecting a T20 to last five days.
A classic trap question: 'Is analogWrite() a true analog voltage?' The correct answer is no — analogWrite() produces a PWM square wave whose duty cycle averages to an apparent voltage. Only boards with a real DAC (like the Arduino Due or Zero on specific pins) can output a true analog voltage.
Practical and Gotcha Questions
Practical questions reveal hands-on experience. Expect to explain pull-up and pull-down resistors and why a floating input reads unpredictably, and to describe debouncing a mechanical button in software (as in the code above) or hardware. You may be asked why you must never write to an ISR-shared variable without volatile, or why long computations inside an interrupt are dangerous. A common gotcha is the difference between == and = in conditionals, and another is integer overflow — noting that millis() overflows after roughly 49.7 days but that unsigned subtraction (now - last) still works correctly across the rollover is a strong signal of depth.
Cricket analogy: Explaining debouncing is like accounting for a batter's fidgeting before settling into stance — you wait for the input to steady before you count it, just as an umpire waits for the ball to settle before signaling.
A frequent bug interviewers plant: computing elapsed time as (targetTime > millis()) with signed math or absolute comparisons breaks when millis() overflows at ~49.7 days. Always use unsigned subtraction — (millis() - startTime) >= interval — which remains correct across the rollover because of unsigned arithmetic wraparound.
- Every sketch has setup() (runs once) and loop() (runs forever); know both cold.
- analogWrite() is PWM, not a true analog voltage — only DAC-equipped boards output real analog.
- Know the three memory types: flash (program), SRAM (volatile runtime), EEPROM (small persistent).
- millis() enables non-blocking timing; delay() blocks and interrupts respond without polling.
- Know UART/Serial, I2C/Wire, and SPI and when each fits.
- Debounce buttons, use pull-up/pull-down resistors, and mark ISR-shared variables volatile.
- millis() overflows near 49.7 days, but unsigned subtraction keeps timing correct across rollover.
Practice what you learned
1. What does analogWrite() actually produce on a standard Uno pin?
2. Which memory type on an AVR Arduino is volatile and only 2 KB on an Uno?
3. Why must an ISR-shared variable be declared volatile?
4. After roughly how long does millis() overflow, and does timing still work?
5. Which bus uses two wires labeled SDA and SCL and addresses multiple devices?
Was this page helpful?
You May Also Like
Arduino Best Practices
Practical conventions for writing reliable, readable, and memory-safe Arduino sketches, from non-blocking timing to power and wiring discipline.
Arduino Quick Reference
A condensed reference of the essential Arduino functions, data types, pin modes, and communication calls for fast lookup while coding.
Choosing the Right Arduino Board
How to pick the correct Arduino board for a project by matching microcontroller, I/O count, memory, connectivity, and voltage to your requirements.
Related Reading
Related Study Notes in Programming
Browse all study notesApache Spark Study Notes
Programming · 30 topics
ProgrammingApache Flink Study Notes
Programming · 30 topics
ProgrammingHadoop Study Notes
Programming · 30 topics
ProgrammingSnowflake Study Notes
Programming · 30 topics
ProgrammingApache Airflow Study Notes
Programming · 30 topics
Programmingdbt (Data Build Tool) Study Notes
Programming · 30 topics