thesolarnomad / lora-serialization

LoraWAN serialization/deserialization library for The Things Network
MIT License
164 stars 26 forks source link

Sending GPS data to TTN using TinyGPS++ #11

Closed navinyate closed 7 years ago

navinyate commented 7 years ago

I tried using Lora-serialisation to send GPD data from Node to TTN, but when I useencoder.writeLatLng(-33.905024, 151.26648); data transmits but when I use encoder.writeLatLng((gps.location.lat(), 6), (gps.location.lng(), 6)); data dosen't transmits. am using `

include

byte mydata[12];

void setup() { Serial.begin(9600); ss.begin(9600); LoraEncoder encoder(mydata);

while (Serial.available() > 0)
if (gps.encode(ss.read()))
if (gps.location.isValid())
{
  int32_t lt = -33.905024;
  int32_t ln =  151.26648;
  encoder.writeLatLng((gps.location.lat(), 6), (gps.location.lng(), 6));
}`

Please help me.

joscha commented 7 years ago

@navinyate .writeLatLng already automatically shortens to 6 decimals, there is no need to do it manually. I can also only recommend to use the LoraMessage class, it makes the handling of the resulting buffer much easier.

joscha commented 7 years ago

Closing this.