Lightning installation: RF, ShiftPWM and multithreading

Hey guys,

first of all: thank you very much for your great work, which helped me a lot in the past! :slight_smile:

I’m currently working on a lightning installation, based on Processing running on an Orange Pi, which analyzes music and gives information on lightning to an arduino, which sends the data over a 433MHz RF module to another arduino, which controls 6 10W RGB LEDs and some stepper motors.

The part, which gives me headaches, is multithreading the second Arduino. I thought of working with a Nano v3.

It should receive RF data continuesly and control the 18 light channels (6x RGB) through some shift registers, plus the stepper motors through another shift register.

I found the library ShiftPWM to be very powerful to control the LEDs.

Example:
When ShiftPWM fades some of the LEDs, it's bound in a loop.
While fading, I want to give over RF the command to fade some more LEDs and turn some steppers.

Problem:
Because of the loop, it can't receive the command and could not control the other LEDs as well as steppers.

Question:
Which is the best way to handle the multithreading?
Is it possible to do this with something like ArduinoThread?
Or is an object-oriented approach more suitable? Like with the Cosa platform? I tried this one, but I would have to port ShiftPWM to Cosa, which looks like a lack of work to me.

Or is there any other way to solve my problem?

Thank you very much for your time and thoughts!

Did you read the doing several things at once tutorial at the top of this forum? It will also help if you post the code you have.