
Originally published byDev.to
Rubyduino compiles Ruby sketches for Arduino boards and uploads the generated firmware.
Under the hood it uses Spinel, a Matz's Ruby AOT compiler, vendored at a pinned revision.
How it works?
Rubyduino adds a small Arduino runtime on top of that C code. Functions like digital_write, delay_ms, analog_read, serial_print, and pulse_in are mapped to small AVR C functions that talk directly to the Arduino UNO hardware registers.
After that, the normal AVR toolchain takes over:
- Ruby sketch
- Spinel turns it into C
- Rubyduino adds the Arduino UNO runtime
-
avr-gcccompiles it into firmware -
avrdudeuploads it to the board
So the Arduino is not interpreting Ruby. It is running compiled AVR machine code that started life as Ruby.
It doesn't use Firmata or RAD... this is something new!
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:
🇺🇸
More news from United StatesUnited States
NORTH AMERICA
Related News
Amazon Employees Are 'Tokenmaxxing' Due To Pressure To Use AI Tools
20h ago
UCP Variant Data: The #1 Reason Agent Checkouts Fail
6h ago

Décryptage technique : Comment builder un téléchargeur de vidéos Reddit performant (DASH, HLS & WebAssembly)
16h ago
How Braze’s CTO is rethinking engineering for the agentic area
10h ago
Encryption Protocols for Secure AI Systems: A Practical Guide
20h ago
