Hi @rickkas7, thank you for helping me.
I tried flashing Tinker online with
STARTUP(cellular_credentials_set("free", "", "", NULL));
From the online console I put D7=HIGH or LOW on digitalWrite on the right, checking for a sensor’s response.
First time I had responses for 17min, then I restarted and I had responses even for 25+ min, reset again and responses for 7min…I can’t really say what’s my interval…5 min maybe?
I put 300 in my setup and loop.
Now I flashed my script from online IDE; flashing ok but it hasn’t even started The led is breathing cyan.
Here’s my code (important parts):
// This #include statement was automatically added by the Particle IDE.
#include "Ublox.h"
#include "cellular_hal.h"
#include "PMS.h"
#include "Wire.h"
#include "PMS.h"
#include "Serial5/Serial5.h"
#include "Ublox.h"
#define window 10000 // the flash firmware window time
#define GPSwait 15000
void setup()
{
Particle.keepAlive(300);
uint8_t osrs_t = 1; //Temperature oversampling x 1
uint8_t osrs_p = 1; //Pressure oversampling x 1
uint8_t osrs_h = 1; //Humidity oversampling x 1
uint8_t mode = 3; //Normal mode
uint8_t t_sb = 5; //Tstandby 1000ms
uint8_t filter = 0; //Filter off
uint8_t spi3w_en = 0; //3-wire SPI Disable
uint8_t ctrl_meas_reg = (osrs_t << 5) | (osrs_p << 2) | mode;
uint8_t config_reg = (t_sb << 5) | (filter << 2) | spi3w_en;
uint8_t ctrl_hum_reg = osrs_h;
Serial.begin(9600);
Serial1.begin(GPS_BAUD);
Serial5.begin(9600);
Wire.begin();
writeReg(0xF2,ctrl_hum_reg);
writeReg(0xF4,ctrl_meas_reg);
writeReg(0xF5,config_reg);
readTrim();
}
Now my loop is like this:
void loop()
{
Particle.connect();
bool cloudReady = Particle.connected();
for (unsigned long starttime = millis(); millis() - starttime < 30000; ) {
// if the cloud is ready
cloudReady = Particle.connected();
delay(1000);
if (cloudReady) {
if (!hasSetKeepAlive) {
hasSetKeepAlive = true;
Particle.keepAlive(300);
String sent = "{ " + getTime() + ", " + getGPS() + ", " + getPM() + ", " + getBME() + ", " + getBattery() + " }";
Particle.publish("BME-PMT-GPS", sent, PUBLIC, WITH_ACK);
// 1s for Particle sent data to cloud
delay(1000);
break;
}
//Serial.println(sent);
}
}
if (!cloudReady)
hasSetKeepAlive = false;
delay(window);
System.sleep(SLEEP_MODE_DEEP, 60, SLEEP_NETWORK_STANDBY);
}
Just started, led is breathing cyan but I cannot ping, even after few seconds after flashing.
Question - probably - unrealted: when I “hard reset” the Electron with tinker+update+tinker, I noticed that Electron becomes cyan (breathing) even after flashing Tinker. How? I didn’t put setCredentials in my local Tinker.