Libraries to Update for the Photon


If you stumble across a library that worked for the Core but doesn’t work for the Photon, list it here!

Web server Library example compiles, but gives linkage errors when flashing a Photon





Webserver, MQTT, HTTPClient


I’d guess @peekay123’s fast version of RGBMatrixPanel lib might be affected, but definetly my PR for that lib with some slightly faster single port access is affected.

BTW: What would be a compiler #define to distinguish between PARTICLE_CORE and PARTICLE_PHOTON and will the existing SPARK define be deprecated soon and be changed into PARTICLE?
If so, there will be loads of libs that make use of #ifdef SPARK (e.g. my own Adafruit_HX83578, Touch_4Wire and PS2Communication)


@ScruffR, the new PLATFORM_ID compiler flag will be used since Particle will have the upcoming Electron and more I assume. For now:


You are correct regarding the SPARK flag in existing code but the new flag is future proof. :smile:


SparkTimes compiles and runs but does not work. The UDP time sync never succeeds; I am debugging it.


The ported TimeAlarms library compiles and runs but does not work correctly. Alarms are triggered by timerOnce when they should not be.


MQTT works for me with photon if you add #include “application.h” in all files, comment out the three spark_wiring* includes, and change all boolean references to bool


Here’s a version of the NeoPixel library that works for the photon, who owns that library in the IDE / wants to update it?

{REMOVED POSTED CODE -BDub} NeoPixel Library Updated Here



I think @BDub owns the GitHub repo. I started playing around with NeoPixels on the Photon last night with the updated files and they worked great. If @BDub is too busy, I can do a diff, modify the library to support both platforms, and submit a pull request.


Wouldn’t it be a good idea to merge this with the current neopixel library and use conditional compilation to target the Core or Photon?


Totally, I thought the library already does that with some defines, but I could be mistaken.


NeoPixel Library has been updated guys! Let me know if you see any issues.


I suppose this may change when we add more devices, but the way I added the Photon was simply to add more of the right delays everywhere appropriate if the build target was a Photon, otherwise none of that is added and the library more or less looks like it did when it was just the Core. This is because the Photon runs at 120MHz vs the 72MHz of the Core, so it needs more delay to have the same timing. Keeping it all together actually helped me fine tune the Core delays as well.




HTTPClient was fixed by adding #include “application.h” to the top of HttpClient.cpp I hate to make a pull request for something so simple, but if the owner wont update it let me know and I will post a new version with the fix included.


I took a stab at this:

It’s pretty rough, but it works for me. It definitely could use a look by someone with more familiar with the internals of both the Photon and the OneWire protocol, but it’s a start!



Hi Beebs, Thanks for doing this. I’m a complete newbie and tried to use your library by “contributing” it, but it said it was missing several files, including “spark.json”. What’s the correct way for me to use it? Thanks for your help!