Learn Arduino with Circuitera
Practice Arduino electronics with interactive Uno lessons, exact runnable sketches, and practical reference and troubleshooting guides.
Inputs, outputs and timing
- Predict PWM duty cycle before fading an Arduino LED — Use a duty-cycle slider to predict the HIGH time of an Arduino Uno PWM output, then test the prediction on a simulated LED circuit.
- Count one Arduino button event per press — Predict events from a stable active-LOW button trace and build an Arduino Uno edge detector with a checked code-order exercise.
- Run two Arduino timers without blocking loop() — Compare two periodic jobs, then run an Uno sketch that flashes the onboard LED and writes a serial heartbeat on separate schedules.
- Which Uno R3 pins work with digitalPinToInterrupt()? — Check the difference between a board pin and an interrupt number and print the supported pin mappings with a small AVR sketch.
- Measure short Arduino intervals across micros() rollover — Work through unsigned elapsed-time subtraction for a wraparound and understand the classic Uno R3 micros() resolution.
- Choose a stable window for an Arduino pushbutton — Pretend LOW first appears at 10 ms, bounces HIGH at 14 ms, then returns LOW at 17 ms.
- Distinguish short and long Arduino button presses on release — Record a timestamp at the debounced press edge.
- Choose whether Arduino timers skip missed periods — A task is due at 100, 200, and 300 ms.
Analog measurement
- Calibrate an Arduino potentiometer to 0–100% — Work through clipping and rescaling measured ADC endpoints, then run the matching Uno A0 sketch in Circuitera.
- Choose a series resistor for a 5 V Arduino LED — Adjust an LED resistor, estimate current from voltage and forward drop, and compare the calculation with a supported low-voltage Uno example.
- Arduino map() extrapolates past its input range — See why Arduino map() can return values outside its output range and how to clamp sensor samples before scaling.
- Read a sensor once before calling Arduino constrain() — Avoid evaluating a moving analog input several times when clamping a value with the classic AVR constrain macro.
- What DEFAULT analogReference means on an Uno R3 — Interpret a 10-bit ADC reading against the Uno R3 supply-derived reference and distinguish raw counts from voltage measurements.
- Why a float gets zero after Arduino integer division — Reproduce truncating integer division in an Arduino C++ sketch and fix the division before assigning its result.
- Stop an Arduino threshold LED from flickering — A light reading hovering around 500 can cross a single threshold on successive samples.
- Predict an Arduino ADC reading from a voltage divider — Place the upper resistor between 5 V and the junction and the lower resistor between the junction and ground.
- Find both gain and offset from two Arduino ADC measurements — A meter measures 1,100 mV at ADC code 200 and 3,950 mV at code 800.
- Reject one isolated Arduino sensor spike with a median — Consider three consecutive readings of 490, 900, and 510.
- Prevent overflow when averaging Arduino ADC samples — Seventy readings of 1,023 add up to 71,610.
Compiler diagnostics
- Fix “expected ; before” in an Arduino sketch — Reproduce a missing semicolon in AVR-GCC and find the unfinished statement immediately before the highlighted token.
- Fix Arduino “undefined reference to setup” — Identify a linker error caused by a missing global void setup() and test the corrected sketch with the same AVR build.
- Fix a redefined loop() after combining Arduino sketches — Understand duplicate Arduino entry points and refactor pasted sketches into one loop() calling two helpers.
- Read “no matching function for call” on Arduino — Read the first failed call and the compiler’s candidate signature to fix a wrong Arduino argument count.
Sensor and display diagnostics
- DHT11 returns NaN on Arduino: keep missing readings separate — Distinguish an invalid humidity sample from zero, then check the configured sensor family, wiring, and read interval.
- SSD1306 OLED stays blank after begin() on Arduino — Separate I²C acknowledgment, framebuffer allocation, and flushing the Adafruit SSD1306 buffer to a 128 × 64 display.
- Interpret Wire.endTransmission() status on an Arduino Uno — Tell apart an I²C address NACK, data NACK and timeout with a minimal address probe for the shipped AVR Wire library.
- Filter held-button repeats with Arduino IRremote 4.x — Read the IRremote 4.7.1 repeat flag and distinguish a new command from a held-button repeat without comparing raw hex alone.
- Choose an HC-SR04 timeout from a distance budget — At about 343 m/s, sound travels roughly 0.0343 cm per microsecond.
- Estimate how long one 8N1 UART byte takes — An 8N1 frame uses one start bit, eight payload bits, and one stop bit.
- Distinguish Serial.read() returning −1 from byte 255 — Serial.read() returns an int.
- Recognize a complete Serial line without waiting in Arduino loop() — Consume only available bytes as loop runs.
- Convert an I²C write or read byte to a seven-bit address — Some datasheets write the address together with the direction bit.
- Trace the byte received during an Arduino SPI transfer — SPI clocks transmit and receive bits during the same exchange.
- Budget SRAM for an Arduino monochrome OLED buffer — A packed monochrome buffer uses one bit per pixel.
Classroom and projects
- Run a Chromebook Arduino lesson without USB access — Plan a board-free 15-minute Chromebook activity with an Uno simulation, a prediction task, and a portable sketch handoff.
- Read a version byte before loading Arduino EEPROM settings — Reserve the first byte for the storage format version.
- Pass an Arduino array and its element count to a helper — At the array declaration, sizeof(values) is the byte size of the whole array.
- Keep an Arduino counter across loop calls with static — An ordinary local variable initialized inside a repeatedly called function starts over each call.
- Trace an Arduino state machine one transition at a time — Give each phase a name and decide which transition follows each state.
- Reduce SRAM for repeated fixed Arduino serial messages — A fixed serial message can be passed through F() on classic Arduino AVR.