Introducing Rubyduino, a Ruby to Arduino UNO compiler based on Matz's Spinel!
Source: Dev.to

Overview
Rubyduino (GitHub) compiles Ruby sketches for Arduino boards and uploads the generated firmware. Under the hood it uses Spinel, Matz’s Ruby AOT compiler, vendored at a pinned revision.
How it works?
Rubyduino adds a small Arduino runtime on top of the C code generated by Spinel. Functions such as digital_write, delay_ms, analog_read, serial_print, and pulse_in are mapped to tiny AVR C functions that interact directly with the Arduino UNO hardware registers.
The normal AVR toolchain then takes over:
- Ruby sketch → Spinel turns it into C
- Rubyduino adds the Arduino UNO runtime
avr-gcccompiles the C into firmwareavrdudeuploads the firmware to the board
The Arduino is not interpreting Ruby; it runs compiled AVR machine code that originated as Ruby. No Firmata or RAD is involved—this is a brand‑new approach.
Tutorial
gem install rubyduino
touch blink.rb
# blink.rb
pin_mode(ArduinoUNO::LED_BUILTIN, ArduinoUNO::OUTPUT)
loop do
digital_write(ArduinoUNO::LED_BUILTIN, ArduinoUNO::HIGH)
delay_ms(100)
digital_write(ArduinoUNO::LED_BUILTIN, ArduinoUNO::LOW)
delay_ms(100)
end
rubyduino blink.rb
Result:
