No Output priniting after read_input_registers

109 views Asked by At

I cannot print anything on pi terminal Please help

from pymodbus.client.sync import ModbusSerialClient
import serial.rs485
import time
import logging
import pprint
pp= pprint.PrettyPrinter(indent=4)
FORMAT = ('%(asctime)-15s %(threadName)-15s'
' %(levelname)-8s %(module)-15s:%(lineno)-8s %(message)s')
logging.basicConfig(format=FORMAT)
log = logging.getLogger()
log.setLevel(logging.DEBUG)
ser = serial.rs485.RS485(port='/dev/serial0', baudrate=19200)
ser.rs485_mode = serial.rs485.RS485Settings(rts_level_for_tx=False,
                                            rts_level_for_rx=True,
                                            delay_before_tx=0.0,
                                            delay_before_rx=-0.0)

client = ModbusSerialClient(method='rtu')
client.socket = ser
client.connect()
print("Connected")

response = client.read_input_registers(address=6, count=2, unit=0x01)


print("Temperature at 0x06: ",response.registers)

client.close()

OUTPUT

pi@raspberrypi:~/ewc_app $ python3 modbus.py
Connected
2022-02-16 17:05:06,928 MainThread      DEBUG    transaction    :140      Current transaction state - IDLE
2022-02-16 17:05:06,928 MainThread      DEBUG    transaction    :145      Running transaction 1
2022-02-16 17:05:06,928 MainThread      DEBUG    transaction    :273      SEND: 0x1 0x4 0x0 0x6 0x0 0x2 0x91 0xca
2022-02-16 17:05:06,929 MainThread      DEBUG    sync           :76       New Transaction state 'SENDING'
0

There are 0 answers