Sha256: ac6f2a11bb2d17dd4983a55288b58ae33c93e08f9fcbd5aab2f691cc3deb57f0

Contents?: true

Size: 523 Bytes

Versions: 5

Compression:

Stored size: 523 Bytes

Contents

require 'bundler/setup'
require 'firmata'
require 'socket'

sp = TCPSocket.open 'localhost', 8023
board = Firmata::Board.new(sp)
 
board.connect
 
puts "Firmware name #{board.firmware_name}"
puts "Firmata version #{board.version}"
 
rate = 0.5
address = 0x52
 
board.on :i2c_reply do |value|
  puts value
end
 
board.i2c_config(0)
board.i2c_write_request(address, 0x40, 0x00)
 
n = 0
while true do
  board.i2c_write_request(address, 0x00, 0x00)
  board.i2c_read_request(address, 6)
  board.read_and_process
  sleep 0.2
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hybridgroup-firmata-0.4.7 examples/wiichuck_read_socket.rb
hybridgroup-firmata-0.4.6 examples/wiichuck_read_socket.rb
hybridgroup-firmata-0.4.5 examples/wiichuck_read_socket.rb
hybridgroup-firmata-0.4.4 examples/wiichuck_read_socket.rb
hybridgroup-firmata-0.4.3 examples/wiichuck_read_socket.rb