Created
April 26, 2016 19:39
-
-
Save sensorian/252510d11058ba3665fd183b9b2da9c2 to your computer and use it in GitHub Desktop.
Uses the SensorsInterface Python module for reading both RTCC data and magnetometer data.
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
#!/usr/bin/python | |
import sys | |
import time | |
import SensorsInterface | |
def main(argv): | |
print "=== Real Time Clock and Calendar ===" | |
print "*************************************" | |
SensorsInterface.setupSensorian() #Initialize the library | |
while True: | |
rtcTime = SensorsInterface.getRTCCtime() | |
sys.stdout.write(str(rtcTime[0]) + "/" + str(rtcTime[1]) + "/" + str(rtcTime[2]) + " " +str(rtcTime[3]) + ":" + str(rtcTime[4]) + ":" + str(rtcTime[5])) | |
sys.stdout.write(" <----> ") | |
magnetometer = SensorsInterface.getMagnetometer() | |
print magnetometer | |
if __name__ == '__main__': | |
try: | |
main(sys.argv[1:]) | |
except KeyboardInterrupt: | |
print("") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment