Skip to content

Instantly share code, notes, and snippets.

@dj1711572002
Created January 7, 2021 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dj1711572002/af04e9344a425910ec296448410d3a29 to your computer and use it in GitHub Desktop.
Save dj1711572002/af04e9344a425910ec296448410d3a29 to your computer and use it in GitHub Desktop.
NTRIP TIME
# include <M5Stack.h>
int i,j,k;
int t,t_1;
int cd[5000];
int td[5000];
void setup() {
M5.begin();
Serial2.begin(115200, SERIAL_8N1,22,21); //M5Stack Grove RX22 TX21
i=0;
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial2.available())
{
char c=Serial2.read();
cd[j%5000]=c;
td[j%5000]=millis();
//Serial.printf("d[,%d,]=,%x,(,%d,),\n\r",i,c,millis());
t_1=millis();
i++;
j++;
}
t=millis();
//if(t-t_1>5 && t-t_1<10 )
if(j>4998)
{
//Serial.printf("N=,%d,dataNo=,%d,t=,%d,t_1=,%d,cdata[0-5]=,%x,%x,%x,%x,%x \n\r",j,i,t,t_1,cdata[0],cdata[1],cdata[2],cdata[3],cdata[4]);
for (k=0;k<j;k++)
{
Serial.printf("cd[,%d,]=,%x,td=,%d\n\r",k,cd[k],td[k]);
}
i=0;
j=0;
exit(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment