module Aio

{github.com/jvalencia80/aio Aio} (Arduino Input/Output) is a robust library with built-in redundancy check for data integrity and command confirmation for remotely controlling {arduino.cc Arduino} boards using Ruby code and the serial port.

It implements lots of functions found in the {arduino.cc/en/Reference/HomePage Arduino Reference} and they even share the same names and parameters for an easier experience.

Example

Blinking a LED:

require "aio"

Aio::Board.new("/dev/ttyUSB0") do |board|
  sleep 0.1 until board.ready?

  board.pinMode(13, Aio::OUTPUT)

  5.times do
    board.digitalWrite(13, Aio::HIGH)
    sleep 0.5
    board.digitalWrite(13, Aio::LOW)
    sleep 0.5
  end
end

Check more examples at the {github.com/jvalencia80/aio/tree/master/examples Github} page.

Installation

  1. Install the {rubygems.org/gems/aio Aio} gem:

    $ gem install aio
  2. Print the sketch required by the library:

    $ aiosketch > sketch.ino

    or

    $ ruby -raio -e "Aio.print_sketch" > sketch.ino
  3. Compile and burn the sketch using the {arduino.cc/en/Main/Software Arduino IDE}.

Limitations

Issues

Post any issues at the {github.com/jvalencia80/aio/issues Github issue tracker}.

Constants

ACK
BAUDRATE

Baud rate (shared with the sketch).

Changing it requires printing and burning the sketch again.

DEFAULT
EXTERNAL
HIGH
INPUT
INPUT_PULLUP
INTERNAL
INTERNAL1V1
INTERNAL2V56
LOW
NAK
OUTPUT
SKETCH

Arduino sketch written in C.

SYNCBYTE
TIMEOUT

Read timeout in milliseconds (shared with the sketch).

Changing it requires printing and burning the sketch again.

Public Class Methods

print_sketch() click to toggle source

Prints the Arduino sketch to STDOUT.

@return [nil]