Hello-
I have purchased a couple of flora color sensors and Neo pixels to try out the Chameleon Scarf project. I would like to demonstrate the project to my class. Is there a way to make the color change continuous instead of having to reset the micro controller? I read on one of the topics that the Piano glove sketch calls out a continuous color change. I am very new to using the products and coding, would I be able to use the coding from the Chameleon scarf project but revise it to be a continuous color change? If so, what would that code be?
Adafruit Flora Color Sensor
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15656
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Adafruit Flora Color Sensor
I would start by moving the last part of setup() starting with uint16_t clear, red, green, blue; to loop()
I'm not sure that will have the desired behaviour though. You might want to add a button and execute that code only when the button is pressed.
Dave
I'm not sure that will have the desired behaviour though. You might want to add a button and execute that code only when the button is pressed.
Dave
- AngelicaSandoval
- Posts: 3
- Joined: Wed Apr 27, 2022 4:06 pm
Re: Adafruit Flora Color Sensor
Thank you.
I would like for the color changing to be continuous similar to the piano glove project except without the added sound. Ideally the on/off button would be hidden as the neo pixels change in color.
I would like for the color changing to be continuous similar to the piano glove project except without the added sound. Ideally the on/off button would be hidden as the neo pixels change in color.
- AngelicaSandoval
- Posts: 3
- Joined: Wed Apr 27, 2022 4:06 pm
Re: Adafruit Flora Color Sensor
I kept getting an error on the sketch. "function definition is not allowed before '{' token. Not sure what I am missing since I am beginner.
Code: Select all
void loop() {
uint16_t clear, red, green, blue;
tcs.setInterrupt(false); // turn on LED
delay(60); // takes 50ms to read
tcs.getRawData(&red, &green, &blue, &clear);
tcs.setInterrupt(true); // turn off LED
}
- Attachments
-
[The extension ino has been deactivated and can no longer be displayed.]
Last edited by dastels on Thu Apr 28, 2022 10:57 am, edited 1 time in total.
Reason: Code block
Reason: Code block
- dastels
- Posts: 15656
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Adafruit Flora Color Sensor
You are missing a closing brace at the end of the colorWipe function. The result is that the compiler is still inside the colorWipe function when it encounters the definition of the loop function and gets confused.
Dave
Code: Select all
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
} // <---- THIS IS THE CLOSING BRACE THAT WAS MISSING
void loop() {
uint16_t clear, red, green, blue;
Please be positive and constructive with your questions and comments.