- Tue Feb 26, 2019 11:52 am
#80817
Thanks Martin. I know the code I posted is not very smart(doing handleClient in every iteration). I already have tried all sorts of things, including something close to what you posted.
Regardless, using your code, I get output like this:
Code: Select all$GLGSV,1,1,00,0*79
$GAGSV,1,1,00,0*74
$GNGLL,,,,,,V,N*7A
$GNRMC,,V,,,,,,,,,,N,V*37
$GNVTG,,,,,,,,,N*2E
$GNGGA,,,,,,0,00,99.99,,,,,,*56
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*33
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,2*30
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,3*31
$GPGSV,1,1,01,02,,,36,0*63
$GLGSV,1,1,00,þ$GNRMC,,V,,,,,,,,,,N,V*37
$GNVTG,,,,,,,,,N*2E
$GNGGA,,,,,,0,00,99.99,,,,,,*56
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*33
$GNGSA,A,1,,,,,,,,,þ—NN‰‰‰‰‰I©²j
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*33
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,2*30
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,3*31
$GPGSV,1,1,01,02,,,36,0*63
$GLGSV,1,1,00,0*79
$GAGSV,1,1,00,0*74K‰‰‰‰‰‰‰‰‰)ÊrÊÊbÊÊrÊÊbÊÊrÊÊb’Rš‚j
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,3*31
$GPGSV,1,1,01,02,,,36,0*63
$GLGSV,1,1,00,0*79
$GAGSV,1,1,00,0*74
$GNGLL,,,,,163007.60,V,N*51
$GNRMC,163008.00,V,,,,,,,,,,N,V*15
$GNVTG,,,,,,,,,N*2E
$GNGGA,163008.00,,,,,0,00,99$GNRMC,163009.00,V,,,,,,,,,,N,V*14
$GNVTG,,,,,,,,,N*2E
$GNGGA,163009.00,,,,,0,00,99.99,,,,,,*75
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*33
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,2*30
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,3*31
$GPGSV,1,1,01,02,,,36,0*63
$GLGSV,1,1,00,0*·C!Ò”êM±A,1,,,,,,,,,,,,,99.99,99.99,99.99,3*31
$GPGSV,1,1,01,02,,,36,0*63
$GLGSV,1,1,00,0*79
which doesn't look any better.
I found out that using SoftwareSerial on other two digital pins works much better, with little (sometimes no) garbage.
The code below is your code, where I only changed Serial to SoftwareSerial.
Code: Select all#include "Network.h"
#include "SoftwareSerial.h"
Network net;
String output ="";
SoftwareSerial swser(D1, D6,false,256); // RX, TX
void setup() {
pinMode(LED_BUILTIN,OUTPUT);
digitalWrite(LED_BUILTIN,HIGH); //turn led off
net.begin();
swser.begin(57600);
}
void loop() {
while (swser.available() == 0) {
delay(1);
}
while (swser.available() > 0) {
char c = swser.read();
output += c;
}
digitalWrite(LED_BUILTIN,LOW); // led on
net.handleClient(output); //if client tries to connect, send him the output string
delay(1);
digitalWrite(LED_BUILTIN,HIGH); //oed off
}
This is some of the output:
Code: Select all$GNVTG,,,,,,,,,N*2E
$GNGGA,164849.00,,,,,0,00,99.99,,,,,,*7E
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*33
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,2*30
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,3*31
$GPGSV,1,1,01,02,,,32,0*67
$GLGSV,1,1,00,0*79
$GAGSV,1,1,00,0*74
$GNGLL,,,,,164849.00,V,N*52
$GNRMC,164850.00,V,,,,,,,260219,,,N,V*19
$GNVTG,,,,,,,,,N*2E
$GNGGA,164850.00,,,,,0,00,99.99,,,,,,*76
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*33
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,2*30
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,3*31
$GPGSV,2,1,08,02,47,068,32,12,56,095,30,14,16,279,,21,00,201,,0*61
$GPGSV,2,2,08,24,14,168,,25,80,343,,36,37,172,,49,34,208,,0*6F
$GLGSV,2,1,05,80,57,144,,81,04,038,,82,52,035,,83,72,222,,0*75
$GLGSV,2,2,05,84,13,218,,0*49
$GAGSV,1,1,00,0*74
$GNGLL,,,,,164850.00,V,N*5A
$GNRMC,164851.00,V,,,,,,,260219,,,N,V*18
$GNVTG,,,,,,,,,N*2E
$GNGGA,164851.00,,,,,0,00,99.99,,,,,,*77
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*33
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,2*30
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,3*31
$GPGSV,2,1,08,02,47,068,33,12,56,095,30,14,16,279,,21,00,201,,0*60
$GPGSV,2,2,08,24,14,168,,25,80,343,,36,37,172,,49,34,208,,0*6F
$GLGSV,2,1,05,80,57,144,,81,04,038,,82,52,035,,83,72,222,,0*75
$GLGSV,2,2,05,84,13,218,,0*49
$GAGSV,1,1,00,0*74
$GNGLL,,,,,164851.00,V,N*5B
The output above has no garbage.
As seen in the code, I opened SoftwareSerial on two random pins, D1 and D6. If I start SoftwareSerial on the Tx and Rx pins, the output looks like the default Serial output.
Is this a hardware issue maybe ?