Hello everyone, I am a post student from UK and doing my personal project. I have to say that I am struggling with my project and I have just started learning and compiling programs for Arduino Uno. I have found a toturial online, which cold be a very good starting point for me to learn how to control 36mm square WS2801 LEDs that I have bought via Arduino. I have some problems with the simplest program from adafruit website in this code:
#include <Adafruit_WS2801.h>
int dataPin = 2;
int clockPin = 3;
// Set the first variable to the NUMBER of pixels. 25 = 25 pixels in a row
Adafruit_WS2801 strip = Adafruit_WS2801(20, dataPin, clockPin);
void setup() {
strip.begin();
// Update LED contents, to start they are all 'off'
strip.show();
}
// fill the dots one after the other with said color
// good for testing purposes
void colorWipe(uint32_t c, uint8_t wait) {
int i;
for (i=0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}
/* Helper functions */
// Create a 24 bit color value from R,G,B
uint32_t Color(byte r, byte g, byte b)
{
uint32_t c;
c = r;
c <<= 8;
c |= g;
c <<= 8;
c |= b;
return c;
}
void loop() {
colorWipe(Color(255, 0, 0), 50);
What I want to do in this case is to set all the LED pixels with red color, which is just a simply start for me to get used to controlling the LEDs lighting. After that, I will move on to control the whole 20 pixels color and lighting to in any way that I wish. But when I run the sketch above, there are some errors informed:
Error compilling.
C:\Users\lenovo\Documents\Arduino\libraries\Adafruit_WS2801\Adafruit_WS2801.cpp: In member function 'void Adafruit_WS2801::updatePins(uint8_t, uint8_t)':
C:\Users\lenovo\Documents\Arduino\libraries\Adafruit_WS2801\Adafruit_WS2801.cpp:130: error: 'SPI' was not declared in this scope
C:\Users\lenovo\Documents\Arduino\libraries\Adafruit_WS2801\Adafruit_WS2801.cpp: In member function 'void Adafruit_WS2801::startSPI()':
C:\Users\lenovo\Documents\Arduino\libraries\Adafruit_WS2801\Adafruit_WS2801.cpp:157: error: 'SPI' was not declared in this scope
C:\Users\lenovo\Documents\Arduino\libraries\Adafruit_WS2801\Adafruit_WS2801.cpp:159: error: 'SPI_MODE0' was not declared in this scope
C:\Users\lenovo\Documents\Arduino\libraries\Adafruit_WS2801\Adafruit_WS2801.cpp:161: error: 'SPI_CLOCK_DIV16' was not declared in this scope
C:\Users\lenovo\Documents\Arduino\libraries\Adafruit_WS2801\Adafruit_WS2801.cpp: In member function 'void Adafruit_WS2801::show()':
C:\Users\lenovo\Documents\Arduino\libraries\Adafruit_WS2801\Adafruit_WS2801.cpp:193: error: 'SPI' was not declared in this scope
Could any one help me with this code? Thanks a lot ahead of time.