Skip to content

Commit 18b5122

Browse files
author
Igor Stoppa
committed
Board Configuration
1 parent 37f16b9 commit 18b5122

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

onboard/program/drivers/board.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from machine import Pin, I2C
2+
from program.drivers.motorcontroller import MotorController
3+
from program.drivers.lcd import LCD
4+
from program.drivers.imu import IMU
5+
#import uasyncio as asyncio
6+
7+
__I2C_SCL = 5
8+
__I2C_SDA = 4
9+
__I2C_FREQ = 400000
10+
__MOTOR_ADDR = 48
11+
__MOTOR_FREQ = 1000
12+
13+
14+
class Board():
15+
def __init__(self):
16+
self.i2c = I2C(scl=Pin(__I2C_SCL), sda=Pin(__I2C_SDA),
17+
freq=__I2C_FREQ)
18+
self.motorcontroller = MotorController(i2c=self.i2c,
19+
addr=__MOTOR_ADDR,
20+
freq=__MOTOR_FREQ)
21+
self.lcd = LCD(self.i2c)
22+
self.imu = IMU(self.i2c)
23+
24+
# loop = asyncio.get_event_loop()
25+
# loop.run_forever()
26+
#
27+
# def test_magnetometer(self):
28+
# print(self.__imu.read_compass())

0 commit comments

Comments
 (0)