Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
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!
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)