]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - examples/pi_busio_i2c.py
Add redefined classes
[Adafruit_Blinka-hackapet.git] / examples / pi_busio_i2c.py
index 93f59e64e1577f1068e6bf3e92b70a45eaaaee46..f3b4eeab62d31ce03248dd7fe7e8ac8a2beca1f8 100755 (executable)
@@ -1,4 +1,5 @@
 import time
+import sys
 import board
 import busio
 
@@ -10,7 +11,8 @@ print("I2C devices found: ", [hex(i) for i in i2c.scan()])
 
 if not 0x18 in i2c.scan():
     print("Didn't find MCP9808")
-    exit()
+    sys.exit()
+
 
 def temp_c(data):
     value = data[0] << 8 | data[1]
@@ -19,6 +21,7 @@ def temp_c(data):
         temp -= 256.0
     return temp
 
+
 while True:
     i2c.writeto(0x18, bytes([0x05]), stop=False)
     result = bytearray(2)