State machine for 8mm NeoPixels

I am trying to write a State machine for 3-8mm neopixels using the Adafruit State machine code for standard Leds. Here is the reference to the Adafruit State Machine code that enables the LEDs to be multitasked: Now for two at once | Multi-tasking the Arduino - Part 1 | Adafruit Learning System

My problem in writing the code is that upon compiling I received the error message: expected initializer before numeric constant on the line: int pixelsPIN 3 = 3; // the number of the LED pin. Can anyone tell me what I need to do to correct this?

I also need to add the color parameters for the Pixels. I put the color at the end of the pixelsPin1 definition (bolded) with the plan to reiterate it in the same way for each pixel. Is that correct?

I am using an Uno

Thanks for your help and advice.

State_Machine_8mm_NeoPixels.ino (2.98 KB)

int pixelsPIN 1 =  6;

why is there a "1" after the variable name?

You seem confused about C/C++ syntax. Maybe you are thinking you’ve expressed some idea of an array.

You seem unaware of how three neopixels connect to an Arduino. Typically all neopixels are run off just one pin, one object. Therein lies the beauty. Use of mapping can make one long string function like as many separate bunches of as many neos as you want.

Read up on neopixels and try some example code. Study it until it makes sense or you have some questjons about it.

Where/what is the Adafruit State maxine? Perhaps if you shared all your code we could see some idea of what you are trying for.

a7

pixels.setPixelColor(1,150,150,150);Is calling a member function of a class, before the object is created (and outside of a function !? ) Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, pixelsPIN, NEO_GRB + NEO_KHZ800);creates the object.

Perhaps if you shared all your code

And within </> code-tags please.

gcjr:

int pixelsPIN 1 =  6;

why is there a "1" after the variable name?

This is the the number of the LED pin. I suspect it should read: int pixelsPIN1

variable name can't have spaces

Got it thanks.