Change val to sensor in temp-server.rb, add lib directory and C library

master
Marvin Johanning 2020-04-20 15:03:00 +02:00
parent 7496028297
commit d7eabf9c30
2 changed files with 3 additions and 3 deletions

BIN
lib/bcm2835-1.52.tar.gz Normal file

Binary file not shown.

View File

@ -12,7 +12,7 @@ while session = server.accept
session.print "Content-Type: text/html\r\n" # To tell the server it's serving HTML
session.print "\r\n" # A new line
val = DhtSensor.read(4,22) # Get the data from the DHT22 from pinout 4
sensor = DhtSensor.read(4,22) # Get the data from the DHT22 from pinout 4
session.print "<meta http-equiv='refresh' content='2' />" # For refreshing the page every two seconds to get new temperature data
session.print "<h2>Raspberry Pi Wetterstation</h2>"
@ -21,9 +21,9 @@ while session = server.accept
session.print "Das aktuelle Datum und die aktuelle Uhrzeit betraegt: #{Time.now}" # Print current time
session.print "<br>"
session.print "Temperatur: #{val.temp.to_i}*C" # Print current temperature
session.print "Temperatur: #{sensor.temp.to_i}*C" # Print current temperature
session.print "<br>"
session.print "Luftfeuchtigkeit: #{val.humidity.to_i}%" # Print current humidity
session.print "Luftfeuchtigkeit: #{sensor.humidity.to_i}%" # Print current humidity
session.close
end