Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Adafruit_WS2801 mbed
main.cpp
- Committer:
- AlanRager
- Date:
- 2015-01-16
- Revision:
- 0:63c1f03ccb9c
- Child:
- 1:54cf3c557fdf
File content as of revision 0:63c1f03ccb9c:
#include "mbed.h"
#include "Adafruit_WS2801.h"
#define LED_NUM 32
#define RED 1
#define GREEN 2
#define BLUE 4
//Init strip of 32
Adafruit_WS2801 leds( LED_NUM, SPI_MOSI, SPI_SCK, WS2801_RGB );
int main () {
int i, color;
color = 1;
while (1) {
for (i = 0; i < LED_NUM; i++){
leds.setPixelColor(
i,
( color & RED ),
( color & BLUE ),
( color & GREEN )
);
}
leds.show();
wait_ms(1);
color = color * 2;
if ( color > GREEN ) {
color = RED ;
}
}
}