[SOLVED] Code flashed to Product devices not working?

Mod edit (@harrisonhjones): Solution: “I install dfu-util via homebrew and then ran particle update… now it is breathing cyan. Thank you!”

I flashed the following code to the electron via product console.

PRODUCT_ID(hidden_from_forum);
PRODUCT_VERSION(hidden_from_forum);

int led = D6; // LED is connected to D0
int pushButton = D5; // Push button is connected to D2

// This routine runs only once upon reset
void setup() 
{
  pinMode(led, OUTPUT); // Initialize D0 pin as output
  pinMode(pushButton, INPUT_PULLUP); 
  // Initialize D2 pin as input with an internal pull-up resistor
}

// This routine loops forever
void loop() 
{
  int pushButtonState; 

  pushButtonState = digitalRead(pushButton);

  if(pushButtonState == LOW){ //If we push down on the push button
    digitalWrite(led, HIGH);  // Turn ON the LED
    Particle.publish("mumson", PRIVATE);
    // Add a delay to prevent getting tons of emails from IFTTT
    delay(5000); 
  }
  else
  {
    digitalWrite(led, LOW);   // Turn OFF the LED 
  }

}

Since I don’t have a device paired to my dev account, I had to compile an .ino file through the particle cli.

I created an empty .ino file with the code, then did particle electron compile
This succeeded in being uploaded to the cloud and was flashed to the device in the product. But now the electron is blinking red… I don’t know how to fix this… nothing is working. The device cannot go into safe mode, either.

Can we get a video of the device?

It’s quite hard to disable safe mode. A video showing you trying to put it in safe mode would be great.

1 Like

Check your PMs for the link to youtube video

Having the video in a PM limits the group of people to help you to one person.

2 Likes

Is there something wrong with my code?

The Particle.publis(“mumson”, PRIVATE) is calling a webhook

I’d take the device out of the breadboard and run a particle update and particle flash --usb tinker in DFU Mode before anything else.

I install dfu-util via homebrew and then ran particle update… now it is breathing cyan. Thank you!

2 Likes

That’s awesome! Glad you got it working. I’m going to go ahead and mark your post as [SOLVED]. :smile: