Libraries to Update for the Photon


@Hotaman, there is a purpose for the checks in the regular GPIO wiring functions. Having the fast_pin functions available gives advanced programmers an extra toolset they can use beyond that. The Photon’s pin mapping does not lend itself to whole-port operations and digitalWriteFast() uses pinSetFast/PinResetFast to do a single command regardless of the target pin state. It is assumed that pinMode() was used prior to using the fast_pin functions.

I believe you are referring to an Arduino register which is not present in the STM32. Furthermore, the GPIO architecture on the STM32 is different. There are several registers in the STM32 for setting a pin’s mode. Can you explain a scenario where fast pinMode() is required?


Has anyone successfully run the plotly library on the Photon, I tried the version from the Web IDE and that hangs the Photon while the version on seems to work but the data doesn’t appear in the plotly grid…


Hi, I’m trying to get started with my Dotstar LEDs and my photon but I have no idea what is going wrong. I’m using sn74hct125n for level shifting. I want to use hw-spi but in the linrary the pin mapping of the sw-spi was brocken so I’ve modified the pin mapping with this:

+#if PLATFORM_ID == 0 // Core
+  #define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin)
+  #define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)
+#elif PLATFORM_ID == 6 // Photon
+  STM32_Pin_Info* PIN_MAP2 = HAL_Pin_Map(); // Pointer required for highest access speed
+  #define pinLO(_pin) (PIN_MAP2[_pin].gpio_peripheral->BSRRH = PIN_MAP2[_pin].gpio_pin)
+  #define pinHI(_pin) (PIN_MAP2[_pin].gpio_peripheral->BSRRL = PIN_MAP2[_pin].gpio_pin)
+  #error "*** PLATFORM_ID not supported by this library. PLATFORM should be Core or Photon ***"
 // fast pin access
-#define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin)
-#define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)

now it compiles. But nothing happens. I hope someone can help me.

Ah by the way the way the Dotstar library of the web ide needs an update.



did you connect to the correct data pin that is defined?


I’m using hardware spi -> A3 for clock and A5 for data. correct?



it is defined in firmware -

Change it to suit your project and test again?


Sorry for being to unclear I#ve modified the Example too. To use the hardware spi I’ve killed all pin settings in the strandtest but with using the define port for using hw spi doesn’t change anything.


After some rebuilds and reflashing the stripe is filling itself up with white color and the speed is something like every second. The filling start at various positions on different starts of the system. This leads me to the thinking it is coupled with clock. I’ve programmed somthing with more speed and colors.


@StuttVoli, I didn’t use any libs with my DotStar setup. i rolled my own code and found some interesting behavior. I’m driving a 1m strip directly off the Particle pin and it works great. You must set every led on the strip or you will get white on the led after the last one you set due to the end frame being all 1’s.


@Hotaman is there a public example of your project? With this perhaps I can fix the library because the community library in the web ide has the map problem too earlier mentioned in this thread for software spi. Thanks


@Dick @boldbigflank Hey folks, I’m also trying to resurrect WarSting on the Photon!

I’m building a “WarBlaster” from a Nintendo Zapper. I got it mostly done during a live workshop session that I haven’t made public, because I ran into some code incompatibilities when trying to flash the old code; once that’s resolved, I’ll do a new VWorkshop to help publicize the Star Wars challenge. :slight_smile:

Here’s the video from that session, so you can see what I’m talking about…

Anyway, I tried resolving the errors, but to no avail; any chance you know how to update the code so the IDE will flash it to my little Photon?

Cheers :slight_smile:


@alexhack The warsting wifiscan library is not necessary any more, check out my pull request which is a start to remove that and use the newer built-in wifi scanning capabilities of the latest firmware.


Woohoo, thanks! I’ll give it a try.


I would have to suggest IRremote (with working IRrecv)


I’m having trouble using Servo , as done in the reference documentation, on my photon.
In the documentation, the Servo in “Servo myservo;” is blue, like int is when typed, its being recognized as a special thing (I’m quite a beginner, not to familiar with the terminology, and am not sure what else to call the special thing). When I tried using servos like this, and like I have on Arduino previously, and try to verify the code, I get an error saying that the “Servo myservo;” is me trying to define a function, and it can’t happen there.


That is a very very minimal description. If you could elaborate on what your issues are, we’d have a better idea what you’re facing or how we could help. Saying: “it doesn’t work” is not that useful…


Just copy past the original error message, that makes more sense to us than a somewhat confusing reworded version of it.
And providing your code (if it’s not too long) would help too.


That would be a “keyword” or a “reserved word/term” I’d guess.


Hmm. I tried verifying a slightly modified version of my code today and it is working fine:

Servo myservo;

int servoPin = D0;

void setup() {

void loop() {

(I know this is about as basic as it gets, I’m just trying to familiarize myself with the photon)

I’m sorry for any inconvenience I may have caused. Thank you for your friendliness.


No worries :+1: