I've tried and this is not the same when I will send to RS485:
and
Only first way works good second not.
This is my task:
I am preparing:
1) sending commands to somfy rts transmitter without feedback(and it works nice),
2) sending commands to somfy with a feedback message. (to do)
This is a function prepared on this forum:
I must prepare also reading data after sending command GET. But I don't know how many chars will be sended. I've tried this:
And also in this function is some problem. But this is second thing. When I receive a data from device I must:
1. Delete last 2 bytes which are the checksum.
2. Inverse all bytes.
Code:
string.char(0x7F,0xF2,0xFA,0xB8,0x43,0xFA,0x00,0x00,0x00,0xFE,0xFD,0x06,0x5B)
and
Code:
'7FF2FAB843FA000000FEFD065B'
Only first way works good second not.
This is my task:
I am preparing:
1) sending commands to somfy rts transmitter without feedback(and it works nice),
2) sending commands to somfy with a feedback message. (to do)
This is a function prepared on this forum:
Code:
function sendSOMFY(command)
require('serial')
port = serial.open('/dev/RS485', { baudrate = 4800, parity = 'odd', duplex = 'half', databits = 8, stopbits = 1 })
port:flush()
port:write(command)
port:close()
sleep(0.1)
end
I must prepare also reading data after sending command GET. But I don't know how many chars will be sended. I've tried this:
Code:
function send_receiveSOMFY(command)
require('serial')
port = serial.open('/dev/RS485', { baudrate = 4800, parity = 'odd', duplex = 'half', databits = 8, stopbits = 1 })
port:flush()
port:write(command)
data = port:read(20, 1)
port:close()
sleep(0.1)
end
And also in this function is some problem. But this is second thing. When I receive a data from device I must:
1. Delete last 2 bytes which are the checksum.
2. Inverse all bytes.