recently i got a tricolor LED strip from RadioShack and it had code with it but it did not work and was filled with errors so i got some code from polulu that has worked for many people and i try'd to upload Rainbow which is a program but i got this message in the compiler
LedStripRainbow:15: error: 'rgb_color' does not name a type
LedStripRainbow:13: error: expected constructor, destructor, or type conversion before '<' token
LedStripRainbow:17: error: 'rgb_color' does not name a type
LedStripRainbow:27: error: 'rgb_color' does not name a type
LedStripRainbow.ino: In function 'void loop()':
LedStripRainbow:52: error: 'colors' was not declared in this scope
LedStripRainbow:52: error: 'hsvToRgb' was not declared in this scope
LedStripRainbow:56: error: 'ledStrip' was not declared in this scope
LedStripRainbow:56: error: 'colors' was not declared in this scope
this is the program i used
/* LedStripRainbow: Example Arduino sketch that shows
- how to make a moving rainbow pattern on an
- Addressable RGB LED Strip from Pololu.
- To use this, you will need to plug an Addressable RGB LED
- strip from Pololu into pin 12. After uploading the sketch,
- you should see a moving rainbow.
*/#include <PololuLedStrip.h>
// Create an ledStrip object and specify the pin it will use.
PololuLedStrip<12> ledStrip;// Create a buffer for holding the colors (3 bytes per color).
#define LED_COUNT 60
rgb_color colors[LED_COUNT];void setup()
{
}// Converts a color from HSV to RGB.
// h is hue, as a number between 0 and 360.
// s is the saturation, as a number between 0 and 255.
// v is the value, as a number between 0 and 255.
rgb_color hsvToRgb(uint16_t h, uint8_t s, uint8_t v)
{
uint8_t f = (h % 60) * 255 / 60;
uint8_t p = v * (255 - s) / 255;
uint8_t q = v * (255 - f * s / 255) / 255;
uint8_t t = v * (255 - (255 - f) * s / 255) / 255;
uint8_t r = 0, g = 0, b = 0;
switch((h / 60) % 6){
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
return (rgb_color){r, g, b};
}void loop()
{
// Update the colors.
uint16_t time = millis() >> 2;
for(uint16_t i = 0; i < LED_COUNT; i++)
{
byte x = (time >> 2) - (i << 3);
colors = hsvToRgb((uint32_t)x * 359 / 256, 255, 255);
}*
// Write the colors to the LED strip.*
ledStrip.write(colors, LED_COUNT); *
delay(10);*
}
[/quote]