Skip to content

Instantly share code, notes, and snippets.

View AndriyHz's full-sized avatar

Andriy Hertz AndriyHz

View GitHub Profile
@AndriyHz
AndriyHz / serialinput.R
Created March 4, 2018 13:57 — forked from jalapic/serialinput.R
Arduino data to R
library(serial)
rm(list = ls()) # clear environment
graphics.off() # close all graphic windows
### establish a serial connection
con <- serialConnection(name = "get_temps",
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
@AndriyHz
AndriyHz / test_LM75.py
Created July 21, 2016 07:56 — forked from whatnick/test_LM75.py
Test LM75 temperature sensor
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)
@AndriyHz
AndriyHz / test_mpl3115.py
Created July 21, 2016 07:55 — forked from whatnick/test_mpl3115.py
Test MPL3115 barometer/altimeter using Python
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()))