Drivers

Artoo has a extensible system for connecting to hardware devices.

HMC6352 Digital Compass


Allows user to read heading from HMC6352 Digital Compass via i2c interface

How To Connect

For Arduino:

require 'artoo'
connection :arduino, :adaptor => :firmata, :port => '/dev/ttyACM0'
device :compass, :driver => :hmc_6352_compass, :connection => :arduino, :interval => 0.5

How To Use

Pretty simple, when the connection and the driver have been setup (as explained above) you can call events on them as follows:

on compass, :heading => proc { |caller, data| puts "heading: #{data}"}

Example using a HMC6352 Digital Compass.

require 'artoo'

connection :arduino, :adaptor => :firmata, :port => '/dev/ttyACM0'
device :compass, :driver => :hmc_6352_compass, :connection => :arduino, :interval => 0.5

work do
  on compass, :heading => proc { |caller, data| puts "heading: #{data}"}
end

Commands

heading

Returns the heading data for the compass.

Params

no params

Returns

float

Events

start_driver

Starts the driver

heading

Gets triggered every time the specified interval is met.

Circuit

Compatibility