Skip to content

Instantly share code, notes, and snippets.

@scaint
Created March 19, 2018 20:13
Show Gist options
  • Save scaint/ffc89a2f4eb8b4425e6650010e2e46a6 to your computer and use it in GitHub Desktop.
Save scaint/ffc89a2f4eb8b4425e6650010e2e46a6 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'dht-sensor-ffi'
gem 'rainbow'
#!/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