Electron Semi-Automatic Mode

I’d like to run my electron in Semi Automatic mode for testing purposes. No need to waste the data :stuck_out_tongue:

When I upload the following code through the DFU, my electron breathes a blue/red light and I do not see any output on the serial monitor. I was wondering if anyone had any suggestions. The code works with my Photon.

#include <vector>
#define DEBUG
// Variables:
std::vector<String> Output;
FuelGauge fuel;
// Address of I2C Pressure Transducer
int I2C_ADDRESS2 = 72; // Address 0x48
long sleepTime = 900; //15 minutes

SYSTEM_MODE(SEMI_AUTOMATIC); // for photon/electron right now

void setup(){
  Wire.begin();        // join i2c bus (address optional for master)
  #ifdef DEBUG
    Serial.begin(9600);  // start serial for output
  #endif
}

void loop()
{
  //WiFi.off();
  char batt[7];
  delay(5000);
  Serial.println("TEST");
  if (collectData(I2C_ADDRESS2)){
    float2string(fuel.getSoC(),batt,3);
    Output.push_back(batt);
    Particle.publish("RG", Output[0] + "," + Output[1] + "," + Output[2]);
    Output.clear();
  }
      //sleep
      delay(500);
}

@knoose, is the Electron firmware version at the same level as the version you compiled your app against?

@peekay123 The firmware on my Electron is 0.5.0 and in the Build tab of the dashboard it says it’s building with that same firmware. However, I’m uploading the code through the DFU utility. Do you know if the DFU utility will use 0.5.1 or the 0.5.0 which I have set in the cloud? Please let me know.

@knoose when you say “DFU utility” do you mean Particle CLI?

@peekay123 Yes, the Particle CLI

@knoose, if you have the Electron connected locally via USB and you use particle update, it will update the Electron with the latest released system firmware which is presently 0.5.1. Make sure to then recompile your own code to this version as well.

@peekay123 Based on your reply, I’m assuming that the Particle CLI uses the most up to date version of the firmware and not the one specified in the Build section of the dashboard? Also, thank you for all your help!

Edit:
After upgrading it’s still breathing Blue/Red. I even changed the code to only contain:

void loop{
   Serial.println("TEST");
}

@knoose blue/red is most likely safe mode. Do you have the latest version of CLI? If so, put the photon in DFU mode and run:

particle update
particle flash --usb tinker

You may need to put the photon back in DFU mode after the update.

@peekay123 When you enter the following into the command line:

 particle update

It does not upgrade to the latest firmware. It downgraded it to 0.4.8, which is what was causing my issues. I manually updated to 0.5.1 and then it worked fine. Thank you for your help.

1 Like

@knoose, if you didn’t get the most recent firmware with particle update I guess you haven’t read this

particle --version

should currently give you 1.14.2

But you could also use this

1 Like