Dino is a Ruby gem that lets you control a connected Arduino with Ruby. It’s very general purpose and already supports lots of hardware that you’d normally connect to an Arudino, including analog sensors, like the TMP36 temperature sensor :
This script will read the value of the sensor connected to pin A0 of an attached Arduino and print the raw 10-bit reading from the ADC:
Note: Some of these features are only available in the latest 0.12.0 branch of the dino gem.
require 'dino' board = Dino::Board.new(Dino::TxRx::Serial.new) tmp36 = Dino::Components::Sensor.new(pin: 'A0', board: board) tmp36.read do |reading| puts reading end
Wouldn’t it be better to get the actual temperature though?Read More »