Module: Rufirmata
- Defined in:
- lib/rufirmata.rb,
lib/rufirmata/pin.rb,
lib/rufirmata/port.rb,
lib/rufirmata/version.rb
Defined Under Namespace
Constant Summary collapse
- DIGITAL_MESSAGE =
Message command bytes - straight from Firmata.h
0x90
- ANALOG_MESSAGE =
send data for a digital pin
0xE0
- DIGITAL_PULSE =
send data for an analog pin (or PWM)
0x91
- REPORT_ANALOG =
PULSE_MESSAGE = 0xA0 # proposed pulseIn/Out msg (SysEx) SHIFTOUT_MESSAGE = 0xB0 # proposed shiftOut msg (SysEx)
0xC0
- REPORT_DIGITAL =
enable analog input by pin #
0xD0
- START_SYSEX =
enable digital input by port pair
0xF0
- SET_PIN_MODE =
start a MIDI SysEx msg
0xF4
- END_SYSEX =
set a pin to INPUT/OUTPUT/PWM/etc
0xF7
- REPORT_VERSION =
end a MIDI SysEx msg
0xF9
- SYSTEM_RESET =
report firmware version
0xFF
- QUERY_FIRMWARE =
reset from MIDI
0x79
- SERVO_CONFIG =
extended command set using sysex (0-127/0x00-0x7F) 0x00-0x0F reserved for user-defined commands */
0x70
- STRING_DATA =
set max angle, minPulse, maxPulse, freq
0x71
- SHIFT_DATA =
a string message with 14-bits per char
0x75
- I2C_REQUEST =
a bitstream to/from a shift register
0x76
- I2C_REPLY =
send an I2C read/write request
0x77
- I2C_CONFIG =
a reply to an I2C read request
0x78
- REPORT_FIRMWARE =
config I2C settings such as delay times and power pins
0x79
- SAMPLING_INTERVAL =
report name and version of the firmware
0x7A
- SYSEX_NON_REALTIME =
set the poll rate of the main loop
0x7E
- SYSEX_REALTIME =
MIDI Reserved for non-realtime messages
0x7F
- UNAVAILABLE =
Pin modes. except from UNAVAILABLE taken from Firmata.h
-1
- INPUT =
as defined in wiring.h
0
- OUTPUT =
as defined in wiring.h
1
- ANALOG =
analog pin in analogInput mode
2
- PWM =
digital pin in PWM output mode
3
- DIGITAL =
Pin types
OUTPUT
- BOARD_TYPES =
ANALOG is already defined above
{ :arduino => { :digital_pins => (0..13).to_a, :analog_pins => (0..5).to_a, :pwm_pins => [3, 5, 6, 9, 10, 11], :use_ports => true, :disabled_pins => [0, 1, 14, 15] #Rx, Tx, Crystal }, :arduino_mega => { :digital_pins => (0..53).to_a, :analog_pins => (0..15).to_a, :pwm_pints => (2..14).to_a, :use_ports => true, :disabled_pins => [0, 1, 14, 15] #Rx, Tx, Crystal } }
- VERSION =
"0.0.7"
Class Attribute Summary collapse
-
.serial_ports ⇒ Object
readonly
Returns the value of attribute serial_ports.
Class Method Summary collapse
Class Attribute Details
.serial_ports ⇒ Object (readonly)
Returns the value of attribute serial_ports.
76 77 78 |
# File 'lib/rufirmata.rb', line 76 def serial_ports @serial_ports end |
Class Method Details
.create_serial_port(options = {}) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/rufirmata.rb', line 78 def create_serial_port(={}) @serial_ports ||= {} = { :serial_port => "/dev/ttyUSB0", :baud_rate => 57600, :parity => SerialPort::NONE, :data_bits => 8, :stop_bits => 1 }.merge() sp = [:serial_port] @serial_ports[] = SerialPort.new(sp, [:baud_rate], [:data_bits], [:stop_bits], [:parity]) end |