14.09.2023, 13:41
With the script below i now can control one motor. But that motor was already programmed by a remote control. Now my question is if someone can tell me if and how it's possible to program a new motor from scratch on please as i totaly don't understand the protocol and all of its functions. There is no manuel explaining the RTS protocol so i'm really confused..
value = event.getvalue()
require('serial')
port = serial.open('/dev/RS485', {
baudrate = 4800,
databits = 8,
stopbits = 1,
parity = 'odd',
duplex = 'half'
})
if value == false then
res, err = port:write(string.char(0x7F,0xF2,0xFA,0xC9,0x7B,0xFA,0x00,0x00,0x00,0xFE,0xFE,0x06,0xA5))
else
res, err = port:write(string.char(0x7F,0xF2,0xFA,0xC9,0x7B,0xFA,0x00,0x00,0x00,0xFE,0xFD,0x06,0xA4))
end
log(res, err)
value = event.getvalue()
require('serial')
port = serial.open('/dev/RS485', {
baudrate = 4800,
databits = 8,
stopbits = 1,
parity = 'odd',
duplex = 'half'
})
if value == false then
res, err = port:write(string.char(0x7F,0xF2,0xFA,0xC9,0x7B,0xFA,0x00,0x00,0x00,0xFE,0xFE,0x06,0xA5))
else
res, err = port:write(string.char(0x7F,0xF2,0xFA,0xC9,0x7B,0xFA,0x00,0x00,0x00,0xFE,0xFD,0x06,0xA4))
end
log(res, err)