I've owned my Particle photon, for little over a week and after flashing my code it's breathing green and I can't flash anymore code to it. Why is this happening and how can I prevent it from occurring?
If you are getting a green breathing light or blinking red on your photon, try this! (Windows only)
Go to the website http://dfu-util.sourceforge.net/releases/
Download the file dfu-util-0.9-win64.zip
Unzip it (Open it and drag and drop the new folder on your desktop)
Open the folder
Place the folder on your desktop
Copy the path (it should be something like this: C:\Users\student\Desktop\dfu-util-0.9-win64)
Go to the control panel -> System and Security -> System -> Advanced System Settings -> Environment Variables -> System Variables -> PATH-> Edit -> New -> Paste the path you just copied inside it.
Click Ok for all three windows
Close control panel
Go to your user folder (eg C:/Users/student)
Create a new folder called anything that is one word(we are using the folder “MyFolder” as an example)
Create a text file and paste a simple program into it(anything you KNOW works)
Place this text file INSIDE your new folder
Change the extension to .ino
Open command prompt, and if it is not in your student directory, use the command cd.. Twice to C:/ and then cd Users and then cd USER(your user name), and then enter the following command
particle compile photon [FOLDER NAME] --saveTo firmware.bin
In our case, it is “particle compile photon MyFolder --saveTo firmware.bin”
Connect your photon using the usb port
Then, hold down the setup button for 3 seconds, tap the reset button, and continue holding down the setup button.
Wait for the arduino light to start blinking magenta, and release the setup button (if the light turns yellow, you have held on too long. Click the reset button and try again)
When the light starts breathing magenta, you are in safe mode.
Now, you have to click and hold the setup button for 3-4 seconds until the light starts blinking blue. Your photon is now in listening/whispering mode.
Then, enter the following command in the command line:
particle flash --serial firmware.bin
And then just hit enter when it asks “Press ENTER when your device is blinking BLUE”
That’s all!! Your device should now work! Wait for a few seconds for it to process.
If it is breathing cyan, your all good!
Now that you know how to solve it, you need to know how to prevent it.
Well if you have any loops at all which run for a Long time, put the line:
Particle.process();
anywhere in the loop.
Now why?
Because your photon needs to connect to the cloud. For some reason, your photon does NOT connect to the cloud when it's in a loop. If the loop goes TOO Long, it will crash as it has no time to connect to the cloud! That's what the breathing green light means.
When you click the reset button on your photon, it RESTARTS your code, it doesn't delete it. So every time your photon starts up again, the code restarts and the problem happens again. What this code above is doing is basically flashing a NEW code onto your photon using the microUSB cable. So no cloud connection is required.
This is something which is annoying, but can be easily prevented. With no factory reset anymore, deleting code off the photon is a Long and tiresome process.
Good luck!