lib/arduino_firmata/main.rb in arduino_firmata-0.0.1 vs lib/arduino_firmata/main.rb in arduino_firmata-0.0.2

- old
+ new

@@ -18,11 +18,11 @@ @digital_output_data = Array.new(16, 0) @digital_input_data = Array.new(16, 0) @analog_input_data = Array.new(16, 0) - @version + @version = nil @serial = SerialPort.new(serial_name, bps, 8, 1, 0) sleep 3 Thread.new{ @@ -38,9 +38,15 @@ end (0...2).each do |i| write(REPORT_DIGITAL | i) write 1 end + + loop do + break if @version + sleep 0.3 + end + sleep 0.5 end def digital_read(pin) (@digital_input_data[pin >> 3] >> (pin & 0x07)) & 0x01 > 0