Skip to content

Commit

Permalink
Create I2C bus in the lolibot module
Browse files Browse the repository at this point in the history
  • Loading branch information
thaytan committed Jan 22, 2018
1 parent 971cbed commit fdfcc4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion software/lib/lolibot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# lib/lolibot.py: version: 2018-01-14 14:00
# lib/lolibot.py: version: 2018-01-19 23:15
#
# Usage
# ~~~~~
Expand Down Expand Up @@ -37,6 +37,8 @@
duty_cycle_min = 200
pwm_frequency = 30

i2c_bus = None

motor_commands = {
"stop": ( 0, 0, 0, 0),
"forward": (1023, 0, 1023, 0),
Expand Down Expand Up @@ -76,6 +78,7 @@ def initialise_motor(settings, motor_pin_name):
def initialise(settings):
global duty_cycle_max, duty_cycle_min, pwm_frequency
global left_motor1, left_motor2, right_motor1, right_motor2
global i2c_bus

if "duty_cycle_max" in settings:
duty_cycle_max = int(settings["duty_cycle_max"])
Expand All @@ -93,3 +96,4 @@ def initialise(settings):

scl = settings["scl_pin"]
sda = settings["sda_pin"]
i2c_bus = machine.I2C(scl=machine.Pin(scl), sda=machine.Pin(sda))

0 comments on commit fdfcc4c

Please sign in to comment.