fixed a problem with undefined variables
This commit is contained in:
parent
24cf87e9dd
commit
cfa669e498
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue
Block a user