Project

General

Profile

Sending data with Python / RF12demo

Added by danst0 almost 4 years ago

Hi,

I am trying to access the RF12demo from python.

This is the code in python
send_out_bytes = str(9) + ', ' +str(190) + ', 0' + ' s\r\n'
ser.write(str.encode(send_out_bytes))

On the receiving end I get an "OK 1" as an answer. But no further data.

What am I missing?
Other data from my Room node is received quite well.

If I try to send out data from another spare RF12demo with a serial console (e.g. "100, 0s") I get:
> 0a
-> 0 b

As a result. What does this mean?

Daniel


Replies (2)

Solved: RE: Sending data with Python / RF12demo - Added by danst0 almost 4 years ago

Despite the manual saying that spaces will be ignored, they do seem relevant. It works if I change the code to
send_out_bytes = str(9) + ',' +str(190) + ',0' + ' s\r\n'
ser.write(str.encode(send_out_bytes))

Daniel

RE: Sending data with Python / RF12demo - Added by jcw almost 4 years ago

Aha - I did not understand either, but that does ring a bell: the RF12demo input code is very basic - it treats commas and spaces as separators, but gets confused by multiple separators, IOW - a single comma or space is fine.

ser.write(`9` + "," + `190` + ",0s\r")

That final "\r" can also be a space or a linefeed, it uses the same separator logic as everything else in RF12demo.

    (1-2/2)