"Undeclared function" error

I entered the sketch for project 7.4 in the Arduino Cookbook 2nd edition (if you don't have the book, here's the code:

/*
* RGB_LEDs sketch
*RGB LEDs driven from analog output ports
*/

const int redPin = 3;
const int greenPin = 5;
const int bluePin = 6;
const boolean invert = true;

int color =0;
int R, G, B;

void setup()
{
}

void loop()
{
  int brightness = 255;
  hueToRGB( color, brightness);
  analogwrite(3, R);
  analogwrite(5, G);
  analogwrite(6, B);
  
  color++;
  if(color > 225)  //
  color = 0;
  delay (10);
}

void hueToRGB( int hue, int brightness)
{
  unsigned int scaledHue = (hue * 6);
  unsigned int segment = scaledHue / 256;
  unsigned int segmentOffset = scaledHue - (segment * 256);
  
  unsigned int complement = 0;
  unsigned int prev = (brightness * ( 225 - segmentOffset)) / 256;
  unsigned int next = (brightness * segmentOffset) / 256;
  if(invert)
  {
    brightness = 255-brightness;
    complement = 255;
    prev = 225-prev;
    next = 225-next;
  }
  
  switch(segment) {
    case 0:
    R = brightness;
    G = next;
    B = complement;
    break;
    case 1:
    R = prev;
    G = brightness;
    B = complement;
    break;
    case 2:
    R = complement;
    G = brightness;
    B = next;
    break;
    case 3:
    R = complement;
    G = prev;
    B = brightness;
    break;
    case 4:
    R = next;
    G = complement;
    B = brightness;
    break;
    case 5:
    R = brightness;
    G = complement;
    B = prev;
    break;
  }
}

)
and in gives me this error:
Cycling_RGB_LED_2.ino: In function 'void loop()':
Cycling_RGB_LED_2:22: error: 'analogwrite' was not declared in this scope

Please help! :~

C++ is case sensitive. analogwrite and analogWrite aren't the same thing.

Ok, thanks :grin: