Fix relays

This commit is contained in:
Tanner 2025-02-28 15:32:57 -08:00
parent 79707cd62f
commit 16bc26d7d2
3 changed files with 10 additions and 6 deletions

View File

@ -661,7 +661,7 @@ def serial_loop(dev_fn):
d['TrqCurrent'] = dmm.read_TrqCurrent() d['TrqCurrent'] = dmm.read_TrqCurrent()
if True: if True:
dmm.set_speed(-30) dmm.set_speed(0)
time.sleep(.5) time.sleep(.5)
d['Speed'] = dmm.measure_speed() d['Speed'] = dmm.measure_speed()

View File

@ -11,6 +11,7 @@ import asyncio
import aiomqtt import aiomqtt
import serial import serial
import glob import glob
import time
import dyn4 import dyn4
import relays import relays
@ -23,8 +24,8 @@ dmm1 = None
dmm2 = None dmm2 = None
MOTOR_EN1 = 0 MOTOR_EN1 = 1
MOTOR_EN2 = 1 MOTOR_EN2 = 2
def enable_motors(): def enable_motors():
logging.info('Enabling both motors...') logging.info('Enabling both motors...')
@ -195,6 +196,7 @@ def task_died(future):
def main(): def main():
enable_motors() enable_motors()
time.sleep(2)
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()

View File

@ -7,10 +7,10 @@ DEVICE_ADDR = 0x10
bus = smbus.SMBus(DEVICE_BUS) bus = smbus.SMBus(DEVICE_BUS)
def relay_on(num): def relay_on(num):
bus.write_byte_data(DEVICE_ADDR, num, 0x00) bus.write_byte_data(DEVICE_ADDR, num, 0xFF)
def relay_off(num): def relay_off(num):
bus.write_byte_data(DEVICE_ADDR, num, 0xFF) bus.write_byte_data(DEVICE_ADDR, num, 0x00)
def test(): def test():
while True: while True:
@ -25,4 +25,6 @@ def test():
if __name__ == '__main__': if __name__ == '__main__':
test() #test()
relay_off(1)
relay_off(2)