forked from Telos4/RoboRally
fixed a problem with undefined variables
This commit is contained in:
parent
24cf87e9dd
commit
cfa669e498
|
@ -2,7 +2,7 @@ import machine
|
||||||
import sys
|
import sys
|
||||||
from machine import I2C, Pin
|
from machine import I2C, Pin
|
||||||
|
|
||||||
i2c = False
|
i2c = True
|
||||||
if i2c:
|
if i2c:
|
||||||
import d1motor
|
import d1motor
|
||||||
else:
|
else:
|
||||||
|
@ -13,14 +13,13 @@ import usocket
|
||||||
import esp
|
import esp
|
||||||
|
|
||||||
class Robot:
|
class Robot:
|
||||||
def __init__(self):
|
def __init__(self, i2c=True):
|
||||||
if i2c:
|
if i2c:
|
||||||
print("setting up I2C ...")
|
print("setting up I2C ...")
|
||||||
#d1 = Pin(5)
|
d1 = Pin(5)
|
||||||
#d2 = Pin(4)
|
d2 = Pin(4)
|
||||||
#i2c = I2C(scl=d1, sda=d2)
|
i2c = I2C(scl=d1, sda=d2)
|
||||||
#i2c_scan = i2c.scan()
|
i2c_scan = i2c.scan()
|
||||||
i2c_scan = []
|
|
||||||
if len(i2c_scan) > 0:
|
if len(i2c_scan) > 0:
|
||||||
i2c_addr = i2c_scan[0]
|
i2c_addr = i2c_scan[0]
|
||||||
print("i2c scan = {}".format(i2c_addr))
|
print("i2c scan = {}".format(i2c_addr))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user