'wheel' was not declared in scope

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

#define PIN 0

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
  #if defined (__AVR_ATtiny85__)
    if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  #endif
  // End of trinket special code


  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  rainbowCycle(10);
}


// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

Wheel and wheel are not the same. Caps matter.

Either one, it still says that 'wheel' or 'Wheel' is not in the scope

If you post the entire error message we can help.

Maybe I'm just being dense, but I don't actually see 'Wheel' being initialised anywhere.

This is where I am getting my code from. Would you happen to know where I should initialize it? I fairly new to Arduino

Arduino: 1.8.4 (Windows 10), Board: "Adafruit Trinket 16MHz"

C:\Users\azul3\Documents\Arduino\sketch_sep04a\sketch_sep04a.ino: In function 'void rainbowCycle(uint8_t)':

sketch_sep04a:45: error: 'Wheel' was not declared in this scope

strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));

^

exit status 1
'Wheel' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Where did you get that code from? I think you're missing part of it. A quick google search for 'adafruit neopixel wheel' gave some interesing results. You might want to try that too.

I got it from this adafruit tutorial, it has a part for just programming the neopixel rings:

I think that you don't have the Neopixel library installed. If you do, then in the IDE go File>Examples>Adafruit NeoPixel>strandtest and see if that compiles.

I did that and it compile fine?

  • I know this is an old thread.....but for the sake of others looking, who may stumble upon this thread... (I happen to be looking for something else)...

The missing 'Wheel', is a function in the code example you copied from and must have not copied all of it...

I believe it is this: (you can find it in many/most neopixel examples on the Adafruit site)

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else if(WheelPos < 170) {
    WheelPos -= 85;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  }
}