Bindings and easy-to-use wrapper classes to make Crystal code interact with TinkerForge components.
-
Add the dependency to your
shard.yml
:dependencies: tinkerforge: github: mathalaxy/tinkerforge branch: master
-
Run
shards install
require "tinkerforge"
staple = TF::Staple.new
staple.connect ip_address: "localhost", port: 4223
if staple.connected?
staple.devices.each do |dev|
case dev
when TF::MasterBrick
puts "Master of the universe!"
when TF::RotaryPotiBricklet
puts "Rotary Poti shows #{dev.position}"
end
end
end
Currently, there is only support for a very limited set of TF components, because these are what I use in other projects. Supported bricks/bricklets are:
If you would like to add support for other components, please feel free to contribute!
- Fork it (https://github.com/mathalaxy/tinkerforge/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- mathalaxy - creator and maintainer