This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(serial) | |
rm(list = ls()) # clear environment | |
graphics.off() # close all graphic windows | |
### establish a serial connection | |
con <- serialConnection(name = "get_temps", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from tentacle_pi.LM75 import LM75 | |
import httplib, urllib | |
from time import localtime, strftime | |
lm = LM75(0x48,"/dev/i2c-1") | |
while(True): | |
temperature = lm.temperature() | |
print "temperature: %0.2f" % temperature |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from tentacle_pi.LM75 import LM75 | |
lm = LM75(0x48,"/dev/i2c-1") | |
temperature = lm.temperature() | |
print "temperature: %0.2f" % temperature | |
time.sleep(2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
temp_raw_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_temp_raw','r') | |
temp_scale_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_temp_scale','r') | |
print "temperature: %.2f" %(int(temp_raw_file.read())*float(temp_scale_file.read())) | |
pres_raw_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_pressure_raw','r') | |
pres_scale_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_pressure_scale','r') | |
print "pressure: %.4f" %(int(pres_raw_file.read())*float(pres_scale_file.read())) |