Writing 1st Arduino Library

Hello, I am writing my first library. I would like to separate the "patterns" from (https://github.com/adafruit/LPD8806/blob/master/examples/LEDbeltKit_alt/LEDbeltKit_alt.pde) I tried to follow(http://arduino.cc/en/Hacking/LibraryTutorialCcccc). But to no avail. Where am I going wrong? Thanks in advance!

patternsSketch:28: error: 'Patterns' was not declared in this scope

//Patterns.cpp
#include "Arduino.h"
#include "Patterns.h"


void Patterns::renderEffect00(byte idx) {
 if(fxVars[idx][0] == 0) {
    byte *ptr = &imgData[idx][0],
      r = random(256), g = random(256), b = random(256);
    for(int i=0; i<numPixels; i++) {
      *ptr++ = r; *ptr++ = g; *ptr++ = b;
    }
    fxVars[idx][0] = 1; // Effect initialized
  }
}

}
//Patterns.h

#ifndef Patterns_h
#define Patterns_h

#include <Arduino.h>

class Patterns 
{

 public:
	
	void renderEffect00();
 private:
};


#endif
//slightly condensed for space.
 //I added the lines with: **********************

#include <patterns.h>//*************
#include <avr/pgmspace.h>
#include "SPI.h"
#include "LPD8806.h"
#include "TimerOne.h"

const int numPixels = 32;
LPD8806 strip = LPD8806(numPixels);

byte imgData[2][numPixels * 3], // Data for 2 strips worth of imagery
     alphaMask[numPixels],      // Alpha channel for compositing images
     backImgIdx = 0,            // Index of 'back' image (always 0 or 1)
     fxIdx[3];                  // Effect # for back & front images + alpha
int  fxVars[3][50],             // Effect instance variables (explained later)
     tCounter   = -1,           // Countdown to next transition
     transitionTime;            // Duration (in frames) of current transition

// function prototypes, leave these be :)
void renderEffect00(byte idx);
void renderEffect01(byte idx);
void renderEffect02(byte idx);
void renderEffect03(byte idx);
void renderAlpha00(void);
void renderAlpha01(void);
void renderAlpha02(void);
void renderAlpha03(void);
void callback();
byte gamma(byte x);
long hsv2rgb(long h, byte s, byte v);
char fixSin(int angle);
char fixCos(int angle);

void (*renderEffect[])(byte) = {
  Patterns.renderEffect00(),
  //renderEffect00,**********************
  renderEffect01,
  renderEffect02,
  renderEffect03 },
(*renderAlpha[])(void)  = {
  renderAlpha00,
  renderAlpha01,
  renderAlpha02 };

// ---------------------------------------------------------------------------

void setup() {
  strip.begin();
  randomSeed(analogRead(0));
  memset(imgData, 0, sizeof(imgData)); // Clear image data
  fxVars[backImgIdx][0] = 1;           // Mark back image as initialized
  Timer1.initialize();
  Timer1.attachInterrupt(callback, 1000000 / 60); // 60 frames/second
}

void loop() {
  // Do nothing.  All the work happens in the callback() function below,
  // but we still need loop() here to keep the compiler happy.
}

void callback() {
  strip.show();

  byte frontImgIdx = 1 - backImgIdx,
       *backPtr    = &imgData[backImgIdx][0],
       r, g, b;
  int  i;

  (*renderEffect[fxIdx[backImgIdx]])(backImgIdx);

  if(tCounter > 0) {
    // Transition in progress
    byte *frontPtr = &imgData[frontImgIdx][0];
    int  alpha, inv;

    // Render front image and alpha mask based on current effect indices...
    (*renderEffect[fxIdx[frontImgIdx]])(frontImgIdx);
    (*renderAlpha[fxIdx[2]])();

    // ...then composite front over back:
    for(i=0; i<numPixels; i++) {
      alpha = alphaMask[i] + 1; // 1-256 (allows shift rather than divide)
      inv   = 257 - alpha;      // 1-256 (ditto)
      r = gamma((*frontPtr++ * alpha + *backPtr++ * inv) >> 8);
      g = gamma((*frontPtr++ * alpha + *backPtr++ * inv) >> 8);
      b = gamma((*frontPtr++ * alpha + *backPtr++ * inv) >> 8);
      strip.setPixelColor(i, r, g, b);
    }
  } else {

    for(i=0; i<numPixels; i++) {
      // See note above re: r, g, b vars.
      r = gamma(*backPtr++);
      g = gamma(*backPtr++);
      b = gamma(*backPtr++);
      strip.setPixelColor(i, r, g, b);
    }
  }

  tCounter++;
  if(tCounter == 0) { // Transition start
    // Randomly pick next image effect and alpha effect indices:
    fxIdx[frontImgIdx] = random((sizeof(renderEffect) / sizeof(renderEffect[0])));
    fxIdx[2]           = random((sizeof(renderAlpha)  / sizeof(renderAlpha[0])));
    transitionTime     = random(30, 181); // 0.5 to 3 second transitions
    fxVars[frontImgIdx][0] = 0; // Effect not yet initialized
    fxVars[2][0]           = 0; // Transition not yet initialized
  } else if(tCounter >= transitionTime) { // End transition
    fxIdx[backImgIdx] = fxIdx[frontImgIdx]; // Move front effect index to back
    backImgIdx        = 1 - backImgIdx;     // Invert back index
    tCounter          = -120 - random(240); // Hold image 2 to 6 seconds
  }
}
//**********************
//*******Put this in to Patterns.h and Patterns.cpp
//***********************
/*
*****void renderEffect00(byte idx) {
*****  // Only needs to be rendered once, when effect is initialized:
*****  if(fxVars[idx][0] == 0) {
*****    byte *ptr = &imgData[idx][0],
*****      r = random(256), g = random(256), b = random(256);
*****    for(int i=0; i<numPixels; i++) {
*****      *ptr++ = r; *ptr++ = g; *ptr++ = b;
*****    }
*****    fxVars[idx][0] = 1; // Effect initialized
*****  }
*****}
*/

//*************
//********rest of file removed to save space. view original work @:
//******** https://raw.github.com/adafruit/LPD8806/master/examples/LEDbeltKit_alt/LEDbeltKit_alt.pde

//Patterns.h
and

#include <patterns.h>//*************

Aren't the same (case).

Does that comment really contribute anything?

Thanks. The comments with ***'s are what i edited. Sorry for any confusion.
I now get:
In file included from patternsSketch.ino:4:
C:\Users\Green\Desktop\arduino-1.0.1\libraries\patterns/Patterns.h:12: error: return type specification for constructor invalid
patternsSketch:28: error: expected primary-expression before '.' token

I tried: void renderEffect00(byte idx);
in Patterns.h. No help there.

C:\Users\Green\Desktop\arduino-1.0.1\libraries\patterns/Patterns.h:12: error: return type specification for constructor invalid

Constructors do not have a return type.

I want to return the byte idx. I am not sure how.

I want to return the byte idx. I am not sure how.

Use a return statement. Not in a function that has a return type of void, though.

patternsSketch:28: error: expected primary-expression before '.' token
updated files:

//Patterns.cpp
#include "Arduino.h"
#include "Patterns.h"


void Patterns::renderEffect00(byte idx) {
 if(fxVars[idx][0] == 0) {
    byte *ptr = &imgData[idx][0],
      r = random(256), g = random(256), b = random(256);
    for(int i=0; i<numPixels; i++) {
      *ptr++ = r; *ptr++ = g; *ptr++ = b;
    }
    fxVars[idx][0] = 1; // Effect initialized
  }
}

}
//Patterns.h

#ifndef Patterns_h
#define Patterns_h

#include <Arduino.h>

class Patterns 
{

 public:
	
	void renderEffect00(byte idx);
 private:
};


#endif
//slightly condensed for space.
 //I added the lines with: **********************

#include <Patterns.h>//*************
#include <avr/pgmspace.h>
#include "SPI.h"
#include "LPD8806.h"
#include "TimerOne.h"

const int numPixels = 32;
LPD8806 strip = LPD8806(numPixels);

byte imgData[2][numPixels * 3], // Data for 2 strips worth of imagery
     alphaMask[numPixels],      // Alpha channel for compositing images
     backImgIdx = 0,            // Index of 'back' image (always 0 or 1)
     fxIdx[3];                  // Effect # for back & front images + alpha
int  fxVars[3][50],             // Effect instance variables (explained later)
     tCounter   = -1,           // Countdown to next transition
     transitionTime;            // Duration (in frames) of current transition

// function prototypes, leave these be :)
void renderEffect00(byte idx);
void renderEffect01(byte idx);
void renderEffect02(byte idx);
void renderEffect03(byte idx);
void renderAlpha00(void);
void renderAlpha01(void);
void renderAlpha02(void);
void renderAlpha03(void);
void callback();
byte gamma(byte x);
long hsv2rgb(long h, byte s, byte v);
char fixSin(int angle);
char fixCos(int angle);

void (*renderEffect[])(byte) = {
  Patterns.renderEffect00(),
  //renderEffect00,**********************
  renderEffect01,
  renderEffect02,
  renderEffect03 },
(*renderAlpha[])(void)  = {
  renderAlpha00,
  renderAlpha01,
  renderAlpha02 };

// ---------------------------------------------------------------------------

void setup() {
  strip.begin();
  randomSeed(analogRead(0));
  memset(imgData, 0, sizeof(imgData)); // Clear image data
  fxVars[backImgIdx][0] = 1;           // Mark back image as initialized
  Timer1.initialize();
  Timer1.attachInterrupt(callback, 1000000 / 60); // 60 frames/second
}

void loop() {
  // Do nothing.  All the work happens in the callback() function below,
  // but we still need loop() here to keep the compiler happy.
}

void callback() {
  strip.show();

  byte frontImgIdx = 1 - backImgIdx,
       *backPtr    = &imgData[backImgIdx][0],
       r, g, b;
  int  i;

  (*renderEffect[fxIdx[backImgIdx]])(backImgIdx);

  if(tCounter > 0) {
    // Transition in progress
    byte *frontPtr = &imgData[frontImgIdx][0];
    int  alpha, inv;

    // Render front image and alpha mask based on current effect indices...
    (*renderEffect[fxIdx[frontImgIdx]])(frontImgIdx);
    (*renderAlpha[fxIdx[2]])();

    // ...then composite front over back:
    for(i=0; i<numPixels; i++) {
      alpha = alphaMask[i] + 1; // 1-256 (allows shift rather than divide)
      inv   = 257 - alpha;      // 1-256 (ditto)
      r = gamma((*frontPtr++ * alpha + *backPtr++ * inv) >> 8);
      g = gamma((*frontPtr++ * alpha + *backPtr++ * inv) >> 8);
      b = gamma((*frontPtr++ * alpha + *backPtr++ * inv) >> 8);
      strip.setPixelColor(i, r, g, b);
    }
  } else {

    for(i=0; i<numPixels; i++) {
      // See note above re: r, g, b vars.
      r = gamma(*backPtr++);
      g = gamma(*backPtr++);
      b = gamma(*backPtr++);
      strip.setPixelColor(i, r, g, b);
    }
  }

  tCounter++;
  if(tCounter == 0) { // Transition start
    // Randomly pick next image effect and alpha effect indices:
    fxIdx[frontImgIdx] = random((sizeof(renderEffect) / sizeof(renderEffect[0])));
    fxIdx[2]           = random((sizeof(renderAlpha)  / sizeof(renderAlpha[0])));
    transitionTime     = random(30, 181); // 0.5 to 3 second transitions
    fxVars[frontImgIdx][0] = 0; // Effect not yet initialized
    fxVars[2][0]           = 0; // Transition not yet initialized
  } else if(tCounter >= transitionTime) { // End transition
    fxIdx[backImgIdx] = fxIdx[frontImgIdx]; // Move front effect index to back
    backImgIdx        = 1 - backImgIdx;     // Invert back index
    tCounter          = -120 - random(240); // Hold image 2 to 6 seconds
  }
}
//**********************
//*******Put this in to Patterns.h and Patterns.cpp
//***********************
/*
*****void renderEffect00(byte idx) {
*****  // Only needs to be rendered once, when effect is initialized:
*****  if(fxVars[idx][0] == 0) {
*****    byte *ptr = &imgData[idx][0],
*****      r = random(256), g = random(256), b = random(256);
*****    for(int i=0; i<numPixels; i++) {
*****      *ptr++ = r; *ptr++ = g; *ptr++ = b;
*****    }
*****    fxVars[idx][0] = 1; // Effect initialized
*****  }
*****}
*/

//*************
//********rest of file removed to save space. view original work @:
//******** https://raw.github.com/adafruit/LPD8806/master/examples/LEDbeltKit_alt/LEDbeltKit_alt.pde
void (*renderEffect[])(byte) = {
  Patterns.renderEffect00(),
  //renderEffect00,**********************
  renderEffect01,
  renderEffect02,
  renderEffect03 },
(*renderAlpha[])(void)  = {
  renderAlpha00,
  renderAlpha01,
  renderAlpha02 };

What is Patterns here? It appears to be an instance of a class, but it is not defined as such. THAT is what the compiler is complaining about.

I'm not sure what a class with one method, no constructor and no destructor, and no fields is contributing, here. Perhaps a class is not what you need. Just because you have a function, a header file, and a source file does not mean that you need a class.

Thank you so much for pointing me in the right direction! I will let you know how I do. Thanks again