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.
Fork of LEDTape_WS2812 by
Revision 1:bbc584b629fa, committed 2013-12-29
- Comitter:
- tkasa
- Date:
- Sun Dec 29 03:15:33 2013 +0000
- Parent:
- 0:d067ddfe3df9
- Commit message:
- change to enable to use new type of WS2812.
Changed in this revision
| LEDStrip_WS2812.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/LEDStrip_WS2812.cpp Mon Jul 08 01:34:51 2013 +0000
+++ b/LEDStrip_WS2812.cpp Sun Dec 29 03:15:33 2013 +0000
@@ -39,10 +39,12 @@
while (_ssp->SR & (1<<1)) { // TNF
if (data[addr] & bit) {
// 1
+ //_ssp->DR = 0x01f;
_ssp->DR = 0x01f;
} else {
// 0
- _ssp->DR = 0x07f;
+ //_ssp->DR = 0x007;
+ _ssp->DR = 0x00F;
}
bit = bit >> 1;
if (bit == 0) {
@@ -58,7 +60,8 @@
} else {
// blank
while (_ssp->SR & (1<<1)) { // TNF
- _ssp->DR = 0xfff;
+ _ssp->DR = 0x000;
+ //_ssp->DR = 0xfff;
if (addr < 50) {
addr ++;
} else {
--- a/main.cpp Mon Jul 08 01:34:51 2013 +0000
+++ b/main.cpp Sun Dec 29 03:15:33 2013 +0000
@@ -14,7 +14,7 @@
}
int main() {
- int i, j, k = 0;
+ int j, k = 0;
pc.baud(115200);
tapeInit(0, 16);
@@ -23,22 +23,43 @@
pc.printf("led\r\n");
for (;;) {
- for (i = 0; i < 256; i ++) {
- led2 = 1;
- tapeSet(0, (i << 16));
- tapeSet(2, (i << 8));
- tapeSet(4, i);
- tapeSet(6, (i << 8)|i);
- tapeSet(7, (i << 16)|i);
- tapeSet(8, (i << 16)|(i << 8));
- tapeSet(9, (i << 16)|(i << 8)|i);
+ for (long int i = 0; i < 256; i++) {
+ int val = i;
+ for(int j=0;j<16;j++){
+ tapeSet(j, val);
+ }
+ tapeSend();
+ wait_ms(2);
+ }
+ }
+ for (;;) {
+ for (long int i = 0; i < 256; i++) {
+ int val = (i << 8)|(255-i);
+ for(int j=0;j<16;j++){
+ tapeSet(j, val);
+ }
tapeSend();
- led2 = 0;
- wait_ms(20);
+ wait_ms(2);
+ }
+ for (long int i = 0; i < 256; i++) {
+ int val = (i << 16)|((255-i)<<8);
+ for(int j=0;j<16;j++){
+ tapeSet(j, val);
+ }
+ tapeSend();
+ wait_ms(2);
}
- for (i = 0; i < 160; i ++) {
- tapeSet(i, 0);
+ for (long int i = 0; i < 256; i++) {
+ int val = ((255-i)<<16)|i;
+ for(int j=0;j<16;j++){
+ tapeSet(j, val);
+ }
+ tapeSend();
+ wait_ms(2);
}
- tapeSend();
+ //for (i = 0; i < 160; i ++) {
+ // tapeSet(i, 0);
+ //}
+ //tapeSend();
}
}
