Class: SerialConnection
- Inherits:
-
Object
- Object
- SerialConnection
- Defined in:
- lib/serial_connection.rb
Instance Method Summary collapse
-
#initialize(port = nil) ⇒ SerialConnection
constructor
A new instance of SerialConnection.
- #putc(byte) ⇒ Object
Constructor Details
#initialize(port = nil) ⇒ SerialConnection
Returns a new instance of SerialConnection.
4 5 6 7 8 9 10 11 12 |
# File 'lib/serial_connection.rb', line 4 def initialize(port=nil) port_str = port || "/dev/tty.usbserial-FTF8DKJT" baud_rate = 19200 data_bits = 8 stop_bits = 1 parity = SerialPort::NONE @serial = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity) @serial.sync = true end |
Instance Method Details
#putc(byte) ⇒ Object
14 15 16 |
# File 'lib/serial_connection.rb', line 14 def putc(byte) @serial.putc(byte) end |