A sketch uses the Arduino functions and libraries it would use on a real board, with the API of its board's core (arduino-esp32, ESP8266, Arduino AVR, arduino-pico, stm32duino; see Boards). Most of them are the real libraries compiled for the simulator; the parts of the chip that a browser does not have (radio, flash, timers) are imitated.
Arduino basics
| Area | Functions |
|---|---|
| Digital pins | pinMode (INPUT, OUTPUT, INPUT_PULLUP, INPUT_PULLDOWN), digitalWrite, digitalRead, attachInterrupt / detachInterrupt |
| Analog | analogRead, analogWrite (PWM), LEDC (ledcAttach, ledcWrite, …), analogWriteRange (ESP8266) |
| Time | millis, micros, delay, delayMicroseconds; the clock with configTime (NTP) and time() / getLocalTime(), set from your computer's clock |
| Pulses | pulseIn, shiftOut, shiftIn, tone / noTone |
| Text | String, Serial.print / println / printf, Serial.read, readStringUntil, … |
| Chip | ESP.restart(), ESP.getChipId() (ESP8266), ESP.deepSleep() (waits, then starts again), temperatureRead() (about 50 °C), MAC address from Settings |
Serial ports, I2C and SPI
Serialis the serial monitor.Serial1/Serial2(begin(baud, SERIAL_8N1, rx, tx)) andSoftwareSerialtalk to UART parts (GPS, energy meter, CO₂ sensor) wired to those pins. A baud rate that does not match the part gives a warning (on a real board: garbage).Wire(I2C) with real ACK/NACK, so an I2C scanner finds the parts you added (examplei2c_scanner.ino).SPIsends bytes to the part whose CS pin is LOW (RFID reader, TFT displays, SD card).
Wi-Fi, MQTT and HTTP
WiFi.begin()connects at once to a simulated network (any SSID and password);WiFi.status(),localIP(),RSSI()andmacAddress()work.PubSubClientconnects to MQTT brokers through WebSocket, with the real buffer of 256 bytes (setBufferSize()to change it) and publishing at QoS 0.WiFiClientSecuregives TLS (setInsecure(),setCACert()).HTTPClientGET / POST / PUT goes through the simulator server to allowed hosts only.
See Network: MQTT and HTTP for how and to where.
Storing data
Preferences(NVS),EEPROM, SPIFFS and LittleFS: kept with the project, so they surviveESP.restart(), Stop / Run and reloading the page. Flash size in the simulator: 256 KB. Erase flash in the board panel clears them.SD: a microSD card module (512 KB card); its files are listed on the part, can be downloaded, and the card can be emptied.
Camera (ESP32-CAM)
esp_camera.h: esp_camera_init, esp_camera_fb_get / fb_return,
esp_camera_sensor_get with frame size, quality, mirror, flip, brightness and more. Every picture is a real JPEG of
the chosen size and quality, from a test pattern or your computer's camera. PIXFORMAT_JPEG only. On a board
without a camera, esp_camera_init() fails with 0x105, like a real ESP32.
Libraries
These Arduino libraries are compiled as they are (pinned versions) and can be #included:
| Library | Version |
|---|---|
| ArduinoJson | 7.4.2 |
| Adafruit BusIO | 1.17.2 |
| Adafruit GFX | 1.12.4 |
| Adafruit SSD1306 | 2.5.15 |
| LiquidCrystal I2C | 1.1.3 |
| Adafruit Sensor | 1.1.14 |
| Adafruit BMP280 | 2.6.8 |
| Adafruit MPU6050 | 2.2.6 |
| BH1750 | 1.3.0 |
| Keypad | 3.1.1 |
| U8g2 | 2.37.1 |
| Adafruit BME280 | 2.3.0 |
| Adafruit AHTX0 | 2.0.6 |
| Adafruit SHT31 | 2.2.2 |
| Adafruit INA219 | 2.1.0 |
| Adafruit ADS1X15 | 2.6.2 |
| HX711 | 0.7.5 |
| TM1637Display | 1.2.0 |
| TinyGPSPlus | 1.0.3a |
| PZEM004Tv30 | 1.2.1 |
| MH-Z19 | 1.5.4 |
| MFRC522 | 1.4.12 |
| Adafruit ST7735 | 1.12.0 |
| Adafruit ILI9341 | 1.7.0 |
Also available, imitated because the real ones drive the chip directly: Adafruit_NeoPixel, OneWire and
DallasTemperature, Stepper, DHT, ESP32Servo / Servo.
Not supported
- OTA updates:
Update.begin()andhttpUpdate.update()always fail with a clear message; a sketch that uses them still compiles and handles the failure. - CoAP and UDP: a browser cannot send UDP.
- Web servers on the board (
WebServer,ESP8266WebServer): nothing could connect to them. - Bit timing of serial and SPI lines: bytes arrive whole.