Particle Photon Breathing Green

Tried to boot it up in safe mode but it’s still giving me problems. The code that caused it to act up is below, but I tried deploying other code and no luck.

    int sara = A0;
int raha = A1;
int saraLED = D0;
int rahaLED = D1;
int noKids = D2;
int bothKids = D3;
int test = D7;

int saraState = 0;
int rahaState = 0;

void setup()
{
  pinMode(saraLED, OUTPUT);
  pinMode(sara, INPUT);

  Particle.variable( "sara", &saraState, INT );

  pinMode(rahaLED, OUTPUT);
  pinMode(raha, INPUT);

  Particle.variable( "raha", &rahaState, INT );
}

void loop()
{
  saraState = analogRead(sara);
  rahaState = analogRead(raha);

  if (saraState > 3000 && rahaState > 3000) {
    digitalWrite(bothKids, HIGH);
  }
  else if (saraState > 3000 && rahaState < 3000) {
    digitalWrite (saraLED, HIGH);
  }
  else if (saraState < 3000 && rahaState > 3000) {
    digitalWrite(rahaLED, HIGH);
  }
  else if (saraState < 3000 && rahaState < 3000) {
    digitalWrite(noKids, LOW);
  }

  else {}

}

Breathing green means the cloud is blocked, though I don’t see anything obvious in the code you’ve posted that would cause that.
What’s this “other code” you mentioned? Could you give Tinker a shot to see if that makes a difference?

Whats tinker? The other code was a simple LED on and off that I used earlier in the week and was 100% fine. (It was from a professor).

Tinker is the Demo code that came with your Photon. You can flash it from the app, as well as from the Web IDE, where it’s listed under examples.
A blinking LED program (also in that list of examples) should work just fine. When running that, do you still get breathing green?

Yup. It’s giving me the same issue. This is the code below.

I don’t want to factory reset it because someone set up the wi-fi settings for me. Any suggestions?

int ledPin = D0;

void setup()
{
  pinMode (ledPin, OUTPUT);
}

void loop ()
{
  digitalWrite (ledPin, HIGH);
  delay (1000);
  digitalWrite (ledPin, LOW);
  delay (1000);
}

That code definitely shouldn’t cause breathing green. Are you sure it’s just breathing green, or are the other colors/patterns as well (a video would be great in this case)?

1 Like

Here’s a movie of it.

Is there a way to just clear all of the code that’s been put on it?

Could you try taking it out of the circuit, putting it in Safe Mode, and flashing that blinking LED example again?
When you flash new code, the previous code gets overwritten, so no need to clear anything. Safe Mode essentially runs the device without your user code, allowing you to connect, even though your code might be interfering otherwise.

Reset it and it finally worked. Thanks!