Created
March 19, 2018 20:13
-
-
Save scaint/ffc89a2f4eb8b4425e6650010e2e46a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
source 'https://rubygems.org' | |
gem 'dht-sensor-ffi' | |
gem 'rainbow' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'bundler/setup' | |
Bundler.require | |
res = DhtSensor.read(4, 11) # GPIO 4, DHT11 sensor | |
puts format('Temperature: %s %s', Rainbow(res.temp).green.bold, Rainbow('°C').bold) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment