Rubyduino compiles Ruby sketches for Arduino boards and uploads the generated firmware.
Under the hood it uses Spinel, a Ruby AOT compiler, vendored at a pinned revision.
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)
endNot bad, huh?
gem install rubyduinoThe command expects the AVR toolchain to be available in PATH, including avr-gcc, avr-objcopy, and avrdude.
On macOS, install the AVR tools with Homebrew:
brew tap osx-cross/avr
brew install avr-gcc avrdudeOn Debian/Ubuntu:
sudo apt install gcc-avr avr-libc avrdudeOn Fedora:
sudo dnf install avr-gcc avr-libc avrduderubyduino examples/hello.rbPass a serial port explicitly when auto-detection is not enough:
rubyduino -p /dev/cu.usbmodem11401 examples/hello.rbMIT