Hello - I've recently bought and built this project (https://learn.adafruit.com/kaleidoscope ... a/overview) and it's all working and really great. The thing is, I need it for a specific thing, and I just want the lights to be white, and on all the time. I've tried to decipher the code of it all (using examples I've found on various sites), but I think I'm better with a soldering iron than with coding! If anyone has the simple code to just make these rings shine white all the time - or can point me to where it can be found - it would be deeply appreciated.
Thanks!
Kaleidoscope Eyes - some simple code
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Kaleidoscope Eyes - some simple code
Replace your loop() function with the following:just make these rings shine white all the time
Code: Select all
void loop()
{
for (int i = 0; i < 32; i++)
{
setPixelColor(i, 100, 100, 100);
}
}
To make it dimmer, use smaller numbers.
- DomMorley
- Posts: 7
- Joined: Mon Nov 24, 2014 10:54 am
Re: Kaleidoscope Eyes - some simple code
Wow - that was fast!
Thank you so much. I'll try that tonight!
Dom
Thank you so much. I'll try that tonight!
Dom
- DomMorley
- Posts: 7
- Joined: Mon Nov 24, 2014 10:54 am
Re: Kaleidoscope Eyes - some simple code
OK, so I've hacked it onto some previously working code I have, ending up in this:
but now I get the error:
Any ideas what's going wrong there?
Thanks again.
Code: Select all
#include <Adafruit_NeoPixel.h>
#define PIN 0
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(32, PIN);
uint8_t mode = 0, // Current animation effect
offset = 0; // Position of spinny eyes
uint32_t color = 0x000000; // Start red
uint32_t prevTime;
void setup() {
pixels.begin();
pixels.setBrightness(85); // 1/3 brightness
prevTime = millis();
}
void loop()
{
for (int i = 0; i < 32; i++)
{
setPixelColor(i, 100, 100, 100);
}
}
Did I mention that I'm a noob! ;-)error: 'setPixelColor' was not declared in this scope
Any ideas what's going wrong there?
Thanks again.
Last edited by Franklin97355 on Mon Nov 24, 2014 1:10 pm, edited 1 time in total.
Reason: Please use [code] tags when posting code they look like </> above the reply window
Reason: Please use [code] tags when posting code they look like </> above the reply window
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Kaleidoscope Eyes - some simple code
That line should read pixels.setPixelColor(i, 100, 100, 100);
- DomMorley
- Posts: 7
- Joined: Mon Nov 24, 2014 10:54 am
Re: Kaleidoscope Eyes - some simple code
That's much happier (no errors) although I've found it just has the effect of pausing the previous programming as opposed to re-setting it and turning it all white.
The spinning rainbows have now stopped going round and are stationary, so it's obviously having some controlling effect, just not doing the 'all just white' thing I was hoping for :-(
Sorry if I'm being a pain!
The spinning rainbows have now stopped going round and are stationary, so it's obviously having some controlling effect, just not doing the 'all just white' thing I was hoping for :-(
Sorry if I'm being a pain!
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Kaleidoscope Eyes - some simple code
You have to completely replace your loop() function with the one I posted (plus Franklin's correction)I've found it just has the effect of pausing the previous programming as opposed to re-setting it and turning it all white.
- DomMorley
- Posts: 7
- Joined: Mon Nov 24, 2014 10:54 am
Re: Kaleidoscope Eyes - some simple code
Ah - sorry. I thought I had! I replaced everything after void loop() with what you said, and I've just tried erasing all manner of combinations as it's clear there's more to the loop() function than I thought. I either make it go to error or it has no effect though. It's painful being a noob :-(
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Kaleidoscope Eyes - some simple code
The loop function is everything from "void loop()" to the end of the file.
This should do what you want.
This should do what you want.
Code: Select all
// Low power NeoPixel goggles example. Makes a nice blinky display
// with just a few LEDs on at any time.
#include <Adafruit_NeoPixel.h>
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
#include <avr/power.h>
#endif
#define PIN 0
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(32, PIN);
uint8_t mode = 0, // Current animation effect
offset = 0; // Position of spinny eyes
uint32_t color = 0xFF0000; // Start red
uint32_t prevTime;
void setup() {
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
pixels.begin();
pixels.setBrightness(85); // 1/3 brightness
prevTime = millis();
}
void loop()
{
for (int i = 0; i < 32; i++)
{
pixels.setPixelColor(i, 100, 100, 100);
}
}
- DomMorley
- Posts: 7
- Joined: Mon Nov 24, 2014 10:54 am
Re: Kaleidoscope Eyes - some simple code
Thanks so much for your effort here - truly appreciated.
I fear there must be something more fundamental wrong with my unit though, as this still doesn't work. In fact, if I load this code when I turn it on, it doesn't do anything at all. I have to load another bit of code (I have a flashy rainbow one that works), and then load this one to get it to do something. And then it just pauses the flashing and moving of the coloured lights from the rainbow display. Nothing white and a couple of the LEDs out (as per the movement of the previous code). Perhaps I have a dodgy Trinket or something?
I fear there must be something more fundamental wrong with my unit though, as this still doesn't work. In fact, if I load this code when I turn it on, it doesn't do anything at all. I have to load another bit of code (I have a flashy rainbow one that works), and then load this one to get it to do something. And then it just pauses the flashing and moving of the coloured lights from the rainbow display. Nothing white and a couple of the LEDs out (as per the movement of the previous code). Perhaps I have a dodgy Trinket or something?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Kaleidoscope Eyes - some simple code
Sorry, I forgot a line. Try this one:
Code: Select all
// Low power NeoPixel goggles example. Makes a nice blinky display
// with just a few LEDs on at any time.
#include <Adafruit_NeoPixel.h>
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
#include <avr/power.h>
#endif
#define PIN 0
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(32, PIN);
uint8_t mode = 0, // Current animation effect
offset = 0; // Position of spinny eyes
uint32_t color = 0xFF0000; // Start red
uint32_t prevTime;
void setup() {
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
pixels.begin();
pixels.setBrightness(85); // 1/3 brightness
prevTime = millis();
}
void loop()
{
for (int i = 0; i < 32; i++)
{
pixels.setPixelColor(i, 100, 100, 100);
}
pixels.show();
}
- DomMorley
- Posts: 7
- Joined: Mon Nov 24, 2014 10:54 am
Re: Kaleidoscope Eyes - some simple code
EUREKA!!!!
FANTASTIC - thank you so much. You have no idea the hours I've spent trawling the web until I got onto this forum, just trying to learn enough code to make this happen.
Thank you very, very much.
FANTASTIC - thank you so much. You have no idea the hours I've spent trawling the web until I got onto this forum, just trying to learn enough code to make this happen.
Thank you very, very much.
Please be positive and constructive with your questions and comments.