Class: DHT11::App

Inherits:
Object
  • Object
show all
Defined in:
lib/dht11/app.rb

Constant Summary collapse

DEFAULT_PIN_BCM =
26

Instance Method Summary collapse

Instance Method Details

#run!Object



5
6
7
8
9
10
11
12
# File 'lib/dht11/app.rb', line 5

def run!
  dht = Sensor.new(DEFAULT_PIN_BCM)
  loop do
    result = dht.read
    puts "Temperature: #{result.temperature}, Humidity: #{result.humidity}"
    sleep 2
  end
end