ZebH
July 19, 2019, 1:40am
1
Hi all,
I am trying to send the word "lng" and the longitude GPS value in one transmission over LoRa. But I can only get it to send the GPS longitude OR the word "lng".
The line that sends this is:
LoRa.print ("lng"), (gps.location.lng(), 6);
Any help with this problem would be great!
Zeb
What do you think that line of code does?
ZebH
July 19, 2019, 3:01am
3
Hi gfvalvo,
I think it sends the word "lng" and the GPS longitude using a LoRa transmitter to a LoRa receiver.
Is this right?
Thanks,
Zeb
ZebH
July 19, 2019, 3:06am
4
....... If it is not correct what is the correct code?
ZebH:
....... If it is not correct what is the correct code?
Hard to tell given that you didn't include a full code or tell us what class the LoRa object is a member of. Does in inherit from the 'Print' class?
Regardless, what you have there now invokes the Comma Operator which is almost never the intent of the person that writes it.
ZebH
July 19, 2019, 3:53am
6
Hi gfvalvo,
The correct line of code that works for sending just the longitude is:
LoRa.print (gps.location.lng(), 6);
And the correct code that works for sending just the word "lng" is:
LoRa.print ("lng");
I am trying to combine the two commands into one command.
How would you recommend I do this?
I am trying to combine the two commands into one command.
Why?
You would be wise to take a look at Robin2's tutorial on SerialInputBasics for ways in which to format messages with start and end markers so that concatenation is really not required.
ZebH
July 19, 2019, 5:10am
8
OK, thanks for the link cattledog!
srnet
July 19, 2019, 6:07am
9
ZebH:
How would you recommend I do this?
Who knows, as you have not posted your code, no-one knows which library you are using with LoRa.........
ZebH
July 19, 2019, 9:58am
10
Hi all,
I have decided to stay with transmitting the values separately.
I will post what LoRa library I am using in the morning, sorry for not posting it before!
Thanks so much for all your help and patience!
Zeb
ZebH
July 20, 2019, 3:09am
11
Hi again,
For reference I am using the LoRa.h library by sandeepmistry.
I made a stupid mistake of thinking that you can't send lots of LoRa.print lines like "LoRa.print (gps.location.lng(), 6);" and LoRa.print ("lng"); in one packet! You actually can!
Thanks for all your help and patience!
Zeb
It would make sense to make one packet that looks like this:
"lng 44.055697"
Or even one packet that looks like this:
"lat 53.176575 lon -35.175956"
The possibilities literally boggle the mind!
ZebH
July 20, 2019, 7:17am
13
Hi jremington,
Thanks for the advice! All the possibilitys sure are mind boggling!
Zeb