Can't flash anything onto my Photon

I tried to flash a piece of code that I found on the internet designed to show the time on a LCD screen. It seemed to flash (light turned purple suspiciously briefly) but after that nothing happened. I tried flashing again but the flash was unsuccessful. I tried to flash other code files which all failed.

Now after I plug in the photon, the light breathes cyan as it connects to my WiFi, but after it connects, the light stays cyan and does not blink or breathe. I tried using a different WiFi network, resetting the photon, running the particle device doctor but nothing seems to work. I haven’t been able to flash a single code file onto the Photon afterwards.

Any insight into fixing this would be really helpful!

Put the photon into dfu and run
Particle update
Then particle flash --usb tinker
That should get you back to a working firmware setup.

Can you show the code you flashed so that we can look at what happened?

1 Like

That fixed it. Thanks!
This was the code.

#include <LiquidCrystal_I2C_Spark.h>

LiquidCrystal_I2C *lcd;

void setup()
{
    Serial.begin(9600);
    
    // The address is typically 0x27. I2C Address: 0x3F
    // https://www.sainsmart.com/new-sainsmart-iic-i2c-twi-1602-serial-lcd-module-display-for-arduino-uno-mega-r3.html
    lcd = new LiquidCrystal_I2C(0x3F /*address*/, 16 /*columns*/, 2/*rows*/);
    lcd->init();
    lcd->backlight();
    lcd->clear();
    Time.zone(+2.00); // setup a time zone, which is part of the ISO6801 format 
}
    

 
void loop()
{
 // sonst friert die Ă„nderung des Wochentages im Display ein und ĂĽberlappt sich mit dem Neuen
 if (Time.now(), "%H:%M:%S" == "00:00:00") 
 {
    lcd->clear();
 }  
  
  lcd->setCursor(0 /*columns*/,0 /*rows*/);
 // lcd->print(Time.timeStr());
  lcd->print(Time.format(Time.now(), "%d.%m. %A"));
  
  
 // Serial.println(Time.format(Time.now(), "%H:%M:%S"));
  lcd->setCursor(4,1);
  lcd->print(Time.format(Time.now(), "%H:%M:%S"));

}

This should be written as

lcd->print(Time.format("%H:%M:%S"));  // format could also be %T

For current time you can omit the input-time parameter.
The full list of format place holders can be found here
http://www.cplusplus.com/reference/ctime/strftime/

I wonder how this works

AFAICT this condition will always be true and hence always clear the LCD.

But the wording of the condition suggests you only want it to clear at midnight (which wouldn’t prevent the display smearing tho’) and to do that you’d rather write this

  if (Time.now() % 864000 == 0) {  // or shorter: if (!(Time.now() % 86400)) 
    // do midnight stuff
  }
1 Like

Thank you. I’ll have another go and see.