Parts ReferenceWriting Arduino Sketches

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:

ExampleDescription
BlinkBlinks the onboard pin 13 LED at 1 Hz
Traffic LightCycles red/yellow/green LEDs on pins 2/3/4
Button to LEDsReads a button on pin 7 and drives three LEDs on pins 2/3/4
RGB Colour CycleFades an RGB LED through colours using PWM on pins 3/5/6

Compiling with Arduino IDE

  1. Open Arduino IDE and write your sketch.
  2. Go to Sketch → Export Compiled Binary.
  3. Find the .hex file in the sketch folder (the one without _with_bootloader).
  4. 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.hex

Supported features

FeatureStatus
Digital I/O (pinMode, digitalRead, digitalWrite)Supported
PWM (analogWrite) on D3/D5/D6/D9/D10/D11Supported
delay() / millis()Supported (simulated time)
analogRead()Returns 0 — ADC not yet modelled
Serial / UARTHardware present; TX/RX activity visible on board LEDs
I2C / SPI / EEPROMNot modelled
BootloaderNot 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 analogWrite on PWM pins 3, 5, and 6. Load the Arduino Uno PWM RGB LED fixture first.