From 16bc26d7d2e1da35c4dd5d498112699cfe19d9f1 Mon Sep 17 00:00:00 2001 From: Tanner Date: Fri, 28 Feb 2025 15:32:57 -0800 Subject: [PATCH] Fix relays --- dyn4.py | 2 +- main.py | 6 ++++-- relays.py | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dyn4.py b/dyn4.py index 3a35a82..9bd4912 100755 --- a/dyn4.py +++ b/dyn4.py @@ -661,7 +661,7 @@ def serial_loop(dev_fn): d['TrqCurrent'] = dmm.read_TrqCurrent() if True: - dmm.set_speed(-30) + dmm.set_speed(0) time.sleep(.5) d['Speed'] = dmm.measure_speed() diff --git a/main.py b/main.py index 687155a..a5293de 100644 --- a/main.py +++ b/main.py @@ -11,6 +11,7 @@ import asyncio import aiomqtt import serial import glob +import time import dyn4 import relays @@ -23,8 +24,8 @@ dmm1 = None dmm2 = None -MOTOR_EN1 = 0 -MOTOR_EN2 = 1 +MOTOR_EN1 = 1 +MOTOR_EN2 = 2 def enable_motors(): logging.info('Enabling both motors...') @@ -195,6 +196,7 @@ def task_died(future): def main(): enable_motors() + time.sleep(2) loop = asyncio.get_event_loop() diff --git a/relays.py b/relays.py index c248797..65f8c70 100644 --- a/relays.py +++ b/relays.py @@ -7,10 +7,10 @@ DEVICE_ADDR = 0x10 bus = smbus.SMBus(DEVICE_BUS) def relay_on(num): - bus.write_byte_data(DEVICE_ADDR, num, 0x00) + bus.write_byte_data(DEVICE_ADDR, num, 0xFF) def relay_off(num): - bus.write_byte_data(DEVICE_ADDR, num, 0xFF) + bus.write_byte_data(DEVICE_ADDR, num, 0x00) def test(): while True: @@ -25,4 +25,6 @@ def test(): if __name__ == '__main__': - test() + #test() + relay_off(1) + relay_off(2)