diff --git a/Python/sock.py b/Python/sock.py index 211281d..256063d 100644 --- a/Python/sock.py +++ b/Python/sock.py @@ -102,7 +102,7 @@ def sendDMX(data): while True: with serial.Serial('/dev/serial0', baudrate=250000, timeout=1, stopbits=serial.STOPBITS_TWO, bytesize=8) as DMXSER:# UART configuration and definition - #DMXSER.cancel_read() + DMXSER.cancel_read() # GPIO_18 to switch RS-485 driver (IC1) to TX-mode GPIO.output(18, GPIO.HIGH) @@ -117,18 +117,29 @@ def sendDMX(data): # send complete data array DMXSER.write(bytearray(DMXDATA)) + # we have to send a string + rtn = "" + + # dont have to send DMXDATA[0], this is the start code + for index in range(1, len(DMXDATA)): + rtn += (str(index) + "=" + str(DMXDATA[index]) + "; ") + + # give debug feedback + print("output ", rtn) + # GPIO_18 to switch RS-485 driver (IC1) to RX-mode - #DMXSER.reset_input_buffer() + DMXSER.reset_input_buffer() GPIO.output(18, GPIO.LOW) # Sleep between TX packages, use time to get RDM packages - #DMXRDM = "" - #DMXRDMFLAG = False + DMXRDM = "" + DMXRDMFLAG = False time.sleep(2) #-----------------------------------------------------------------------DMXSER.timeout(DMXSLP / 1000.0) # between 0 - 1 sec - #DMXRDM = DMXSER.readlines(hint=none) - #DMXRDMFLAG = True + DMXRDM = DMXSER.readline() + print("input", DMXRDM) + DMXRDMFLAG = True