Writing Arduino Sketches for de:volt
de:volt runs compiled Intel HEX firmware through avr8js in the browser. It does not include a C++ compiler. You compile your sketch outside de:volt and upload the resulting .hex file.
Built-in examples
The Sketch panel includes four built-in examples that are pre-compiled and ready to use:
| Example | Description |
|---|---|
| Blink | Blinks the onboard pin 13 LED at 1 Hz |
| Traffic Light | Cycles red/yellow/green LEDs on pins 2/3/4 |
| Button to LEDs | Reads a button on pin 7 and drives three LEDs on pins 2/3/4 |
| RGB Colour Cycle | Fades an RGB LED through colours using PWM on pins 3/5/6 |
Compiling with Arduino IDE
- Open Arduino IDE and write your sketch.
- Go to Sketch → Export Compiled Binary.
- Find the
.hexfile in the sketch folder (the one without_with_bootloader). - Upload it using the Sketch panel’s Upload .hex button.
Compiling with arduino-cli
# Install once
brew install arduino-cli
arduino-cli core install arduino:avr
# Compile your sketch
arduino-cli compile --fqbn arduino:avr:uno --output-dir ./build MySketch/
# The HEX is at:
# ./build/MySketch.ino.hexSupported features
| Feature | Status |
|---|---|
Digital I/O (pinMode, digitalRead, digitalWrite) | Supported |
PWM (analogWrite) on D3/D5/D6/D9/D10/D11 | Supported |
delay() / millis() | Supported (simulated time) |
analogRead() | Returns 0 — ADC not yet modelled |
| Serial / UART | Hardware present; TX/RX activity visible on board LEDs |
| I2C / SPI / EEPROM | Not modelled |
| Bootloader | Not needed — HEX loads directly |
Tips
- Keep sketches dependency-free (no third-party libraries) for guaranteed compatibility.
- Use
digitalWrite(13, HIGH/LOW)to see the onboard “L” LED respond. - Wire up series resistors on all LED anodes — de:volt models real overcurrent.
- The RGB Colour Cycle example uses
analogWriteon PWM pins 3, 5, and 6. Load the Arduino Uno PWM RGB LED fixture first.