Class: Z4box::Iot
- Inherits:
-
Object
- Object
- Z4box::Iot
- Defined in:
- lib/z4box.rb
Overview
generic iot io class.
Instance Method Summary collapse
- #<<(i) ⇒ Object
-
#initialize(p) ⇒ Iot
constructor
A new instance of Iot.
Constructor Details
#initialize(p) ⇒ Iot
Returns a new instance of Iot.
136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/z4box.rb', line 136 def initialize p @sp = SerialPort.new(p, 115200, 8, 1, SerialPort::NONE) #just read forever Process.detach( fork { while true do while (i = @sp.gets.chomp) do puts %[#{i}] end end } ) end |
Instance Method Details
#<<(i) ⇒ Object
147 148 149 |
# File 'lib/z4box.rb', line 147 def << i @sp.puts(i) end |