LoRaWAN - RAK WIRELESS

Place code snippets and demo code here
tcpipchip
Posts: 76
Joined: Fri Apr 02, 2021 12:48 am
Been thanked: 59 times

Re: LoRaWAN - RAK WIRELESS

Post by tcpipchip »

HERE IS
+EVT:RX_1:-46:10:UNICAST:2:30

In this case, i extracted the 30
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

Re: LoRaWAN - RAK WIRELESS

Post 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....
tcpipchip
Posts: 76
Joined: Fri Apr 02, 2021 12:48 am
Been thanked: 59 times

Re: LoRaWAN - RAK WIRELESS

Post 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!
tcpipchip
Posts: 76
Joined: Fri Apr 02, 2021 12:48 am
Been thanked: 59 times

Re: LoRaWAN - RAK WIRELESS

Post 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
Post Reply