Fix relays
This commit is contained in:
parent
79707cd62f
commit
16bc26d7d2
2
dyn4.py
2
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()
|
||||
|
|
6
main.py
6
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()
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user