Forum Replies Created
-
AuthorPosts
-
4 February 2024 at 17:22 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29624
Hi renzo,
I think I have a solution for myself, maybe for others too.
I have created a new static method in the class LoraE220:@staticmethod def _cleanData(_data): data = bytes(_data) ret_values = [] ret_arr = bytearray(ret_values) for i in range(len(_data)): if _data[i] <= 127 : ret_arr.append(_data[i]) return ret_arr
This methode is called before the decode function:
str_ret = LoRaE220._cleanData(data) data = str_ret.decode('utf-8') msg = data
Now the decoding function works and if I define a separator for the sender, I can separate the messages from each other.
-
This reply was modified 1 year, 3 months ago by
woto.
4 February 2024 at 16:06 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29623Hi Renzo,
I tried it, but it does not work. I get the following error in der Thonny-IDE:>>> b'0212024.2.2 15:26:34 3cm\xf60212024.2.2 15:26:35 22cm'.encode('utf-8','ignore').decode("utf-8") Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'bytes' object has no attribute 'encode' >>>
3 February 2024 at 11:24 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29619Hello,
When I enter the following in the Thonny IDE, I get an error message:
>>> b'\xf0'.decode() Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeError: >>>
I think the problem is the character \xf0.
This does not seem to be a Unicode character. Unfortunately, µPython does not allow you to specify a second parameter in the decode() function, e.g.data.decode('UTF-8','ignore')
.This does not work.
But how can this be solved?-
This reply was modified 1 year, 4 months ago by
woto.
2 February 2024 at 17:06 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29615Hello,
I now have data issued to me.
In lora_e220.py, I insert on line 636 (before data = data.decode(‘utf-8’):
print (data)
If I receive all 4s, I get the following output:
b’0212024.2.2 15:14:25 5cm’
After 4s the next output:
b’0212024.2.2 15:14:29 19cm’If I receive every second, Data looks like this:
b’0212024.2.2 16:59:58 7cm\xf00212024.2.2 16:59:59 19cm’After “7cm” it says \xf0. What does that mean?
2 February 2024 at 16:07 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29612Hello,
I would now like to switch off the FEC in the Python programm.
How can I do this?Thanks Woto
25 January 2024 at 13:36 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29415Hi g0730n,
thanks for answer.
I will test the function “ReceiveMessageUntil()”. Maybe it could help me.23 January 2024 at 17:02 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29363ok, I read
https://mischianti.org/ebyte-lora-e32-micropython-exploring-library-2/
now.I think it is on, because the Default-Value is ON.
23 January 2024 at 15:51 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29361Hi g0730n,
I do not know “FEC”. What does it mean?20 January 2024 at 12:41 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29309The sender is a ATTiny1616 and the receiver is a Rapsberry Pi pico.
-
This reply was modified 1 year, 4 months ago by
woto.
20 January 2024 at 12:40 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29308Hi Renzo,
yes, that’s right.best regards
Woto18 January 2024 at 16:25 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29297Hi Renzo,
I send with the following command:
e220ttl.sendFixedMessage(0, DESTINATION_ADDL, 18, DateTimeStr + " ,Hello, world?" + String (i));
The variable DateTimeStr is:
DateTime nowTime = MCP7940.now(); // get the current time String DateTimeStr = String(nowTime.year()) + "." + String(nowTime.month()) + "." + String(nowTime.day()) + " " + String(nowTime.hour()) + ":" + String(nowTime.minute()) + ":" + String(nowTime.second());
OWN_ADDH = 0x00 OWN_ADDL = 0x01 i is an integer
If I send all 6s, everything is fine. Only if I send every second does this message appear and the programme stops.
17 January 2024 at 19:16 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29291Hi Renzo,
I have now found a little time to reproduce the error.When I send a message every second I get the following message in the Thonny editor:
Traceback (most recent call last): File "<stdin>", line 127, in <module> File "/lib/LoraWanE220/lora_e220.py", line 636, in receive_message UnicodeError:
Maybe you can help me.
best regards
Woto16 January 2024 at 13:25 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29289Hi Renzo,
excuse me for the late answer.I will do it today in the evening.
best regards,
woto15 January 2024 at 12:16 in reply to: E220 LoRa Receive-Intervall and MycroPython and Arduino Env communication (UnicodeError:) #29268Hi Renzo,
if the transmitter sends within 2sec, then the Micropython programme as receiver is terminated with the error unicode-error at line 636 in lora_e220.py.
What could be the reason for this? The message is only a few bytes long:
“Hello World! 1”. The next message is then “Hello World! 2” and so on.best regards
WotoHello together,
I think, I have found the mistake.
The E220 module only works with 5 V (according to the data sheet) and my circuit only had 3.3 V. After I supplied the module with 5 V, it works without any problems.Best regards
Woto -
This reply was modified 1 year, 3 months ago by
-
AuthorPosts