Hi Dave, thank you for your help. I put it in a class because it's part of a larger project where I'll be taking input from microphones, running an ML model, getting a result, and run different devices based on this result including these pancake motors, LED lights, etc. I'll have a single file that imports the different classes for these devices to run them from one place.
This is the library for the DRV2605L Haptic Controller:
https://github.com/adafruit/Adafruit_DRV2605_Library
This is the example code I used to help me write the code below:
https://learn.adafruit.com/adafruit-drv ... cuitpython
This is the code for the pancake motors and DRV2605L haptic controller. Please let me know if you need more info. Thank you:
import board
import busio
import adafruit_drv2605
import time
class Steering_Wheel_MotorController:
def __init__(self, effect_num=118):
# Initalize I2C bus and DRV2065 module
self.i2c = busio.I2C(board.SCL, board.SDA)
self.drv = adafruit_drv2605.DRV2605(self.i2c)
# Set effect number
self.effect_num = effect_num
def run(self,run_time=5):
# Run vibrations
self.drv.sequence[0] = adafruit_drv2605.Effect(self.effect_num)
# Run for five seconds then stop
self.drv.play()
time.sleep(run_time)
self.drv.stop()
This is the code pertaining to the pancake motors and DRV2605L haptic controller in my single file that runs all my devices:
from steering_wheel_motor_control import Steering_Wheel_MotorController
# Running Steering Wheel Motors
steering_wheel_mc = Steering_Wheel_MotorController(effect_num=118)
steering_wheel_mc.run()