This thread contains links to Wokwi simulations for some of the Arduino Built-In Examples The built-in examples are available within the IDE under the File/Examples/ tab.
Basics
- Analog Read Serial tutorial
- Analog Read Serial Simulation -- Reads an analog pin and prints the results to serial
- Bare Minimum code needed tutorial
- Simulation does nothing, but can test your compiler/upload connection.
- Blink tutorial
- Simulation -- Blinks a LED based on delay(1000). Often used to test your IDE and system. Do see Blink Without Delay.
- Digital Read Serial Tutorial
- Simulation -- Reads a digital pin and prints the results on the serial port.
- Fading a LED tutorial
- Simulation --Ramp LED PWM up and down based on
delay()
.
- Simulation --Ramp LED PWM up and down based on
- Read Analog Voltage tutorial
- Simulation -- reads an analog input, converts it to voltage, and prints it to the serial port.
Digital
- Blink Without Delay tutorial
- How to Wire and Program a Button tutorial
- Simulation
- forum discussion -- Some ways are easier and safer than others. Read the forum discussion and the InputPullupSerial example.
- Debounce on a Pushbutton tutorial
- Simulation -- toggle an LED after the switch stops bouncing.
- InputPullupSerial tutorial
- State Change Detection (Edge Detection) for pushbuttons tutorial
- Simulation -- Acts on the changes when a button is pressed or released, rather then the level.
- forum discussion
- Simple keyboard using the tone() function tutorial
- Play a Melody using the tone() function tutorial
- Tone on Multiple Speakers tutorial
- Pitch follower using the tone() function tutorial
Analog
- Analog In, Out Serial tutorial
- Simulation -- Control a PWM output with an analog input.
analogRead() -> map() -> PWM -> analogWrite() & Serial
- Simulation -- Control a PWM output with an analog input.
- Analog Input tutorial
- Simulation -- Uses an analog input to control the blink-rate of a LED
- Analog Write with 12 LEDs on an Arduino Mega, tutorial
- Calibrate Sensor Input,tutorial
- Simulation -- Adapt full-scale PWM output to working range of sensor (ArduinoBIE_Calibration - Wokwi ESP32, STM32, Arduino Simulator) --
- Fading, tutorial
- Smoothing Readings From an Analog Input, tutorial
Communication
- ASCII Table tutorial
- Simulation -- Prints a table of characters in decimal, hex, octal, and binary.
- Create a LED Dimmer tutorial
- (communicates in Binary with processing, not simulated)
- Create a Graph with Processing tutorial
- (communicates in Binary with processing, not simulated)
- MIDI Note Player
tutorial- (Writes MIDI codes to the serial port, not simulated)
- Use Multiple Serial Ports on the Arduino Mega
tutorial - Physical Pixel tutorial
- Read ASCII String tutorial
- Simulation parses 3 integers from Serial to drive an RGB led.
- Serial Call and Response (handshaking) tutorial
- Serial Call and Response (handshaking) with ASCII-encoded output tutorial
- Simulation -- Reports sensor data to Serial when prompted.
- SerialEvent tutorial
- Simulation -- Demonstrates serialEvent() to collect a line without blocking. (could use serialAvailable())
- See also: Serial Input Basics - updated and @nickgammon on Serial
- SerialPassthrough tutorial
- Virtual Color Mixer tutorial
Control Structures
- How to Use Arrays tutorial
- For Loop Iteration (aka The Knight Rider) tutorial
- Switch (case) Statement, used with sensor input
tutorial - Switch (case) Statement, used with serial input tutorial
- While Loop tutorial
- Simulation -- Calibrate sensor range during button-press using
while()
- Simulation -- Calibrate sensor range during button-press using
- If Statement (Conditional Statement) tutorial
Sensors
- ADXL3xx Accelerometer tutorial
- Detect a Knock tutorial
- Memsic 2125 Accelerometer
- Ping Ultrasonic Range Finder tutorial
Non-Arduino Serial communication simulations:
Serial Input Basics by @Robin2
- Example 1 -- Receiving single characters.
- Example 2 -- Receive several chars with an end marker.
- Example 3 -- Receive with start- and end-markers
- Example 4 -- Receiving a single number from the Serial Monitor
- Example 5 -- Receiving and parsing several pieces of data
- Example 6 -- Program to receive binary data
How to process incoming serial data without blocking by @nickgammon
- Example 1: Non-blocking line buffering -- Non-blocking line buffering
- Example 2: Serial parsing state machine -- state-machine for parsing commands. E.g.
R4500S80G3
Misc
- Serial parsing RPN/Postfix:
- pcRead by @gcjr -- one-character parsing diagnostic/control tool (w/ Simulation).
- Good Forum thread on parsing a line into tokens with strtok()
- My adaptations of @nickgammon's state-machine parser into a switch-case single-letter post-fix parser for commands and numbers. E.g.
4500R 80S 3G
or '123 24 /p`:- V1: Simple RPN number and command parsing and
- V2: RPN 4 function calculator+commands
- V3: Serial control of Stepper speed, acceleration and motion control with RPN calc -- Use Serial to control a stepper with real-time adjustment of Acceleration, Maximum speed and Position, with 4-function calculator.
- txtZyme (github) with Wokwi sim of txtZyme modified for Stepper Motor
- G-code parsers, commonly used in CNCs, 3Dprinters, laser cutters
- Marginally Clever G-code parser -- Accumulates a line of serial into a buffer then processes it. Written such that the parsing characters could be made non-blocking with a substitution of an 'while' with an 'if' in the
loop(){}
- grbl -- buffer characters and parse on end-of-line
- Teacup 3DP firmware -- parse a character at a time
- Marlin -- parse a buffered line.
- Marginally Clever G-code parser -- Accumulates a line of serial into a buffer then processes it. Written such that the parsing characters could be made non-blocking with a substitution of an 'while' with an 'if' in the
======
The list is an incomplete version of Arduino Built-In Examples. I think it is useful for folks that can't be bothered to wire up an example, or for folks without hardware, so they can examine the behavior of a tested working example. It might also help folks explain how one, can, for example, use the basic analog and LED examples to handle their very special devices that provide or consume digital or analog outputs.
If you know of, or want to build other simulations of the Arduino Built-In Examples, please point them out and I'll add them to this list.
If you want to discuss the dangers, failings, obvious improvements and next steps, or finer points of a particular built-in example, please start a separate forum thread for it along the lines of How to Wire and Program a Button or State Change Detection (Edge Detection) for pushbuttons and I can add that discuss to this list.