Last active
April 6, 2017 02:11
-
-
Save donghee/3447220 to your computer and use it in GitHub Desktop.
ws2801 simple version for mbed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mbed.h" | |
DigitalOut cki(p6); | |
DigitalOut sdi(p5); | |
int i; | |
int main(){ | |
while(1){ | |
cki=0; | |
wait_ms(1); | |
// RED | |
for(i=0;i<8;i++){ | |
cki=0; | |
sdi=0; | |
wait_ms(0.1); | |
cki=1; | |
wait_ms(0.1); | |
} | |
// GREEN | |
for(i=8;i<16;i++){ | |
cki=0; | |
sdi=1; | |
wait_ms(0.1); | |
cki=1; | |
wait_ms(0.1); | |
} | |
// BLUE | |
for(i=16;i<24;i++){ | |
cki=0; | |
sdi=1; | |
wait_ms(0.1); | |
cki=1; | |
wait_ms(0.1); | |
} | |
cki=0; | |
wait_ms(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment