Here is a sample code that doesn’t work anyway
…
#include "AssetTracker.h"
SYSTEM_MODE(AUTOMATIC) //SEMI_AUTOMATIC
//SYSTEM_THREAD(ENABLED)
AssetTracker t = AssetTracker()
String gAtResponse;
int callbackAT(int type, const char* buf, int len, char* param)
{
gAtResponse = buf;
gAtResponse[len]='\0';
Serial.println("Length: " + (String) len+ " Buff:"+gAtResponse);
return WAIT;
}
void setup()
{
t.begin();
t.gpsOn();
pinMode(D7, OUTPUT);
Serial.begin(9600);
}
void loop()
{
t.updateGPS();
Serial.println("NMEA:");
Serial.println(t.preNMEA()); //Never print any output even when I have a fix
Serial.println("IMEI READ:");
err = Cellular.command(callbackAT, response, 10000, "AT+CGSN\r\n");
if (err == RESP_OK)
Serial.println(gAtResponse);
//Light up D7 LED
digitalWrite(D7, HIGH);
delay(1000);
//Switch off LED
digitalWrite(D7, LOW);
delay(500);
//Check IP address
Serial.print("IP Address: ");
Serial.println(Cellular.localIP());
}
…
Observations:
- Without SYSTEM_THREAD(ENABLED), nothing is printed to hyperterminal and the LED D7 never lights up. The RGB LEDS however does blink white(indicating there is connection). Without LED D7 blinking and no output it shows the code is not even being executed.
- With SYSTEM_THREAD(ENABLED), I get outputs on hyperterminal, LED D7 blinks but I never get a connection i.e. RGB LED only blinks blue
- With SYSTEM_THREAD(ENABLED) and calling Cellular.connect() in loop(), I can get connection at time but most of the time not.
- I have not succeeded to print NMEA data with t.preNMEA(); evene when I have a fix
So with this effect, I do not have any mean to see my code being executed (LED 7 on and off) and getting connections.