def __init__(self, tilt_angle): ''' Construct an IMU task function by initilizing any shared variables and initialize the IMU object @param tilt_angle The shared variable between tasks that contains the IMU title readings ''' self.tilt_angle = tilt_angle self.imu = BNO055.bno055 (pyb.I2C (1, pyb.I2C.MASTER, baudrate = 100000), micropython.const(0x28))
""" #Yellow Encoder Cable: B7 #Gray Encoder Cable: B6 import pyb import motor import controller import utime import BNO055 import micropython # Create all objects DC_Motor_1 = motor.MotorDriver(5, pyb.Pin.board.PC1, pyb.Pin.board.PA0, pyb.Pin.board.PA1) IMU = BNO055.bno055(pyb.I2C(1, pyb.I2C.MASTER, baudrate=100000), micropython.const(0x28)) Controller_1 = controller.Controller(1.35, 0.01) #### # Setup/Initialization def setup(): ''' This initializes the encoder and motor to zero values. ''' IMU.zero_Euler_vals() # DC_Motor_1.set_duty_cycle(0) Controller_1.set_setpoint(10) # Continuous loop def loop(): ''' This is the main loop that handles the DC Motor step response functionality. '''