Another Neopixel project controlled by the Spark Core

Just wanted to share my under cabinet Neopixel project I’ve been working on driven by the Spark Core and controlled by an Android app. The Android app is based off of the Tinker app source code.

The Android app and Core firmware have been designed so that if you want to add a new LED sequence (aka mode) for your Neopixels, you only have to re-flash the Core with the new mode. The Android app reads in the list of available modes from the Core every time the app is launched. The Android app code should never need to be updated.

It’s easy to update the firmware on the Core, It’s a little more work to have to support the Android app to reflect the new Neopixel mode you just created. So the beauty of this project is that you only have to do code work in one spot.
The app displays a list view of all of the modes and gives you dynamic control of the brightness and speed (delay). I have a temperature sensor inside my project box that houses the Spark Core and the +5V power supply. The temp reading can be displayed in the app view or can be turned off in the settings found in the app menu.

Some modes allow the user to select a desired color(s). i.e. The COLORALL mode will pop up a color picker dialog and the user could select all the LEDs to be blue. After selecting blue, there is a round color icon displayed for the function in the list view of the app that will turn blue as well. Up to six colors can be customized for each mode. The number of colors needed for each mode is declared in the modeStruct struct array in the Core firmware. The mode name and number of colors is assembled comma delimited in the modeList cloud variable during the setup routine.

The list view of the modes will not populate unless it gets the modeList cloud variable from the Core and you have to set the Spark Core Neopixel Driver in the settings page of the app. If you have more than one Core (or Photon) registered, the app will always default to selecting this device from your list of Cores when the app launches.

I hope all that makes sense :slight_smile:

The app can be found for free on google play here.
All the source code for the app and the Core firmware can be found here.

The Project Box

The Under Cabinet Pixels

The App

9 Likes

Hi @sparcules

I´ve tried to compile your code in the Spark Cloud IDE but it throws me an error when I “verify” the code from Github:

…/…/…/build/target/user/platform-6/libuser.a(neopixel.o): In function CloudClass::syncTime()': /spark/compile_service/shared/workspace/6_hal_12_0/firmware-private/user/../wiring/inc/spark_wiring_cloud.h:103: undefined reference tospark_protocol_send_time_request’
collect2: error: ld returned 1 exit status
make: *** [34c928a558344a8fe16602e091d285ea009c51288568514fefc6e92acd51.elf] Error 1

Not sure but I´am damn sure that I exactly follow your description on Github. Did you know that error, or did I messed it up?

:smiley: cheers and great project

Update:
Maybe this step I am not sure if that works:
4. Copy and paste the SparkPixel.ino code into the app, replacing any existing text.

Does it conflict with the a-rainbow.cpp?

Hi @clyde,

I just re-followed the instructions on github and it works for me. But I have a Spark Core device selected.

Doing a little digging, it looks like you must be trying to flash a Photon.
It looks like using syncTime() is causing the error when you have a Photon device selected, see issue #426
I selected my Photon and then I get the same error that you are getting.

Try commenting out Spark.syncTime(); on line 309.

Update:
I added a Note on gitub to comment this line out when flashing a Photon.

1 Like

Commented out line 309 - verification - works like a charm!

Thx sparcules!

1 Like