Class: Smalrubot::TxRx::Serial
- Defined in:
- lib/smalrubot/tx_rx/serial.rb
Constant Summary collapse
- BAUD =
19_200
Constants inherited from Base
Instance Method Summary collapse
- #handshake ⇒ Object
-
#initialize(options = {}) ⇒ Serial
constructor
A new instance of Serial.
- #io ⇒ Object
Methods inherited from Base
#flush_read, #gets, #read, #write
Constructor Details
Instance Method Details
#handshake ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/smalrubot/tx_rx/serial.rb', line 18 def handshake while tty_devices.length > 0 begin if on_windows? io; sleep 3 end return super rescue BoardNotFound @tty_devices.shift if @io @io.close end @io = nil end end raise BoardNotFound end |
#io ⇒ Object
14 15 16 |
# File 'lib/smalrubot/tx_rx/serial.rb', line 14 def io @io ||= connect end |