diff --git a/micropython_firmware/main.py b/micropython_firmware/main.py index ea79278..9b23838 100644 --- a/micropython_firmware/main.py +++ b/micropython_firmware/main.py @@ -2,7 +2,7 @@ import machine import sys from machine import I2C, Pin -i2c = False +i2c = True if i2c: import d1motor else: @@ -13,14 +13,13 @@ import usocket import esp class Robot: - def __init__(self): + def __init__(self, i2c=True): if i2c: print("setting up I2C ...") - #d1 = Pin(5) - #d2 = Pin(4) - #i2c = I2C(scl=d1, sda=d2) - #i2c_scan = i2c.scan() - i2c_scan = [] + d1 = Pin(5) + d2 = Pin(4) + i2c = I2C(scl=d1, sda=d2) + i2c_scan = i2c.scan() if len(i2c_scan) > 0: i2c_addr = i2c_scan[0] print("i2c scan = {}".format(i2c_addr))