Skip to content

Instantly share code, notes, and snippets.

View sergiomaia's full-sized avatar
💭
Focused

sergiomaia sergiomaia

💭
Focused
View GitHub Profile
@sergiomaia
sergiomaia / gettemp.rb
Last active August 28, 2015 01:02 — forked from henriqueutsch/chartkick.js
Temperature monitor raspberry pi DS18B20 sensor
require "json"
def temp()
number = Dir.glob('/sys/bus/w1/devices/*').count-1
if number>0
@temperatures = Array.new
Dir.glob('/sys/bus/w1/devices/*').each_with_index {|folder, index|
values = Hash.new
foldername = folder.gsub('/sys/bus/w1/devices/','')