Last active
July 21, 2016 07:55
-
-
Save whatnick/232a5010faa201dc41cc9c85738a47b9 to your computer and use it in GitHub Desktop.
Test MPL3115 barometer/altimeter using Python
This file contains 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())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment