Buffering messages in Smartthings shield

I have been trying to build a led strip (30 led Neopixel from adafruit). All works ok if I am exchanging messages just to set the color / brightness etc for the entire strip as its a one time action on the arduino code and then the code can go back to reading incoming messages.

But if I need to do some animations like running lights etc which needs some loops in the arduino code then the issue I am having is that the messages sent from the cloud are not received by the run / messagecallout function.

Does the smart thing shield buffer the messages coming in so that I can collect and process them later after running through my code cycles in arduino .

Also since arduino does not support threading I am not sure what the solution is.

I can make it all work if I use another arduino where one is paired with Smartthings and receives the messages and the other runs the loops for led light processing and looks for gpio state change. I don’t want to do that as it will make it a very expensive project.

Let me know if there is a workaround.

Thanks
Mohit

I had a similar situation when I was building my TV lift controller.
Within the main loop, in addition to running the SmartThings code, I was also reading the pin states of the various limit switches, as well as setting the output pin states that drive the motors.
When I was setting the output pin states every loop cycle, the arduino wasn’t able to process incoming SmartThings messages.
I changed the code to use boolians (reflecting the output states), and then only set the output pins when the boolians changed. From a CPU POV, reading input pins is “free”, setting output pins takes much more processing.
Not sure if this helps.
Have a look in the Blog, there’s a arduino light project in there, which appears to not suffer from this problem. Maybe his sketch will offer some insight.

Edit:, I just looked, all his code is within the messageCallout function. So the main loop only has the SmartThings.run command.