You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering is Pi_Piper able to read DS18B20 heat sensor ? If yes, how to do it ?
If not, any recommendation gem or solutions ?
My goal is to push the temperature data to Dashing dashboard.
My code works fine run in terminal.
def gettemp(id)
filename = 'w1_slave'
filepath = File.new("/sys/bus/w1/devices/#{id}/#{filename}", "w").path
# “File” belongs to IO class, which contain I/O stream. http://ruby-doc.org/core-2.0.0/IO.html
File.open(filepath) { |f|
lines_arr = f.read.lines.to_a
lines_arr.shift(1)
temp_arr = lines_arr.to_s.partition(/.t=/) # saperate the ["xx xx xx xx xx t=", "34.xxxx"]
@temp = temp_arr.last.to_f/1000
}
return @temp
end
# Use for startup the file
if __FILE__ == $0 then
puts "Temp : #{gettemp('28-031581efbaff'})
end
Hey @elmatou
Great, thank you! I could wait and just let me know if you need some hand. Actually, I'm not good enough to do you some help, but I can test it after Sunday!
Hi Folks,
Pi_piper is great !
I'm wondering is Pi_Piper able to read DS18B20 heat sensor ? If yes, how to do it ?
If not, any recommendation gem or solutions ?
My goal is to push the temperature data to Dashing dashboard.
My code works fine run in terminal.
Below is I'm trying to read the sensor in Dashingm but it seems not able to fire the FILE correctly.
Please advice, thank you in advance !
The text was updated successfully, but these errors were encountered: