Is there a way to run two separate programs from two different pins on the same photon simultaneously?

I have a comet animation that I want to run on a 6 meter LED strip.

I want to run another comet animation (basically the same one except the comets will run in the opposite direction) on another 6 meter LED strip.

I don’t want to run them in the same program because the two strips together will add up to 1728 LEDs, and the program will run more slowly with the greater number of LEDs, so I’d rather run the two strips on two separate programs.

My question is, do I need a separate Photon Microcontroller to do this? Or is it possible to run two programs on two different pins on the same Photon Microcontroller simultaneously?

First off, you’ve made at least three other topics regarding this. It’s generally not appreciated to make duplicate threads, especially if the others are your own. Please try to contain related questions to one topic.

As for your question, no, you can’t really do that. It’s a microcontrollers, which is meant to do one thing, and one thing only. If you’re tasking it with multiple things to do, it will take longer to do them.

1 Like

Sorry. Thanks for the feedback.

I have a question just out of curiosity…if a microcontroller can run only one program at a time, why are there so many pins on one microcontroller?

Because you can still use those sequentially.
A piano has more than 10 keys, even though humans (normally) have only 10 fingers. Wonderful things can happen if you operate them in the right order :wink:

5 Likes

It sounds like you want to have two separate NeoPixel / Dotstar / etc… animations running on different pins at the same time. This is possible to do, but it might require some deep dives into the low level workings of the microcontroller. You would want to take full control over the memory used for the animations, and the output driver. The best way I believe to accomplish this would be to use DMA to PWM output, load the entire animation into RAM and set both running to their respective pins. That said, this can get complicated fast… so be prepared to dive in and learn how everything works. I’m just assuming you’re using NeoPixels… so here’s a DMA controller for that https://github.com/monkbroc/autopixel/blob/master/prototype/application.cpp

TIP: Because your animation has the same data for both strips, you might be able to use half the memory.

1 Like