Page 3 of 3

Re: LoRaWAN - RAK WIRELESS

Posted: Tue Nov 28, 2023 4:42 pm
by tcpipchip
HERE IS
+EVT:RX_1:-46:10:UNICAST:2:30

In this case, i extracted the 30

Re: LoRaWAN - RAK WIRELESS

Posted: Tue Nov 28, 2023 6:17 pm
by Fernando Perez
If you want to extract the seventh field from a character string in which the fields are delimited by ":", you can use the Annex word$() statement.
And to change the state of the pins according to the extracted value, I would use SELECT CASE.

Code: [Local Link Removed for Guests]

  ' r$ = "+EVT:RX_1:-46:10:UNICAST:2:30"  ' uncomment for debug
  ' wlog "r$ = "; r$
  ' wlog

  s$ = word$(r$, 7, ":")
  wlog s$

  SELECT CASE s$
    CASE "31" : pin(23) = 1
    CASE "32" : pin(19) = 1
    CASE "33" : pin(18) = 1
    CASE "34" : pin(5)  = 1
    CASE "35" : pin(23) = 0
    CASE "36" : pin(19) = 0
    CASE "37" : pin(18) = 0
    CASE "38" : pin(5)  = 0
  END SELECT   
But there is something I still don't understand: in your code, the line:
s$= left$(s$, INSTR(1, s$, "+EVT")-1)
It keeps giving me an error, which is logical since instr() will never find the string "+EVT" and will return zero. And zero minus one....

Re: LoRaWAN - RAK WIRELESS

Posted: Tue Nov 28, 2023 9:24 pm
by tcpipchip
hi
getting this

+EVT:TX_DONE

+EVT:RX_1:-48:9:UNICAST:3:31
+EVT:LINKCHECK:0:24:1:-48:9

Package Sent
31
+EVT <--------- ???

Thanks to the help!

Re: LoRaWAN - RAK WIRELESS

Posted: Tue Nov 28, 2023 9:28 pm
by tcpipchip
I forgot to say to you that those messages comes only one message (not separeted by 13,10) on received uart buffer...i dont now why...maybe is the loRa Radio that is not sending the UNICAST message with 13,10
+EVT:RX_1:-48:9:UNICAST:3:31
+EVT:LINKCHECK:0:24:1:-48:9