Neopixel Brick

Dependencies:   NeoPixel mbed

Files at this revision

API Documentation at this revision

Comitter:
Hinz
Date:
Mon Dec 11 12:55:19 2017 +0000
Parent:
3:14dc18aceca9
Commit message:
ok

Changed in this revision

NeoPixel.lib 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 14dc18aceca9 -r 1f676d6961e8 NeoPixel.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NeoPixel.lib	Mon Dec 11 12:55:19 2017 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/FCLabOvGU/code/NeoPixel/#037882a8e193
diff -r 14dc18aceca9 -r 1f676d6961e8 main.cpp
--- a/main.cpp	Wed Jun 07 13:16:58 2017 +0000
+++ b/main.cpp	Mon Dec 11 12:55:19 2017 +0000
@@ -1,21 +1,45 @@
 #include "mbed.h"
+#include "neopixel.h"
+
+NeoPixel npx(D6,8);
 
-//------------------------------------
-// Hyperterminal configuration
-// 9600 bauds, 8-bit data, no parity
-//------------------------------------
+void setByte(uint8_t bits, uint32_t color)
+{
+    for (int i=0; i<8; i++) 
+        if (bits & 1 << i)
+            npx.setColor(i,color);
+        else
+            npx.setColor(i,0);    
+    npx.show();
+}
 
-Serial pc(SERIAL_TX, SERIAL_RX);
 
-DigitalOut myled(LED1);
 
-int main()
-{
-    int i = 1;
-    pc.printf("Hello World !\n");
-    while(1) {
-        wait(1);
-        pc.printf("This program runs since %d seconds.\n", i++);
-        myled = !myled;
+int main() {
+    int i;
+  
+    for (i=0; i<8; i++)
+     npx.setColor(i,0x00ff00);    
+    npx.show();
+    wait(5.0);
+
+    npx.setColor(0,0xff0000);    
+    npx.setColor(1,0x00ff00);    
+    npx.setColor(2,0x0000ff);    
+    npx.setColor(3,0xffff00);    
+    npx.setColor(4,0x00ffff);    
+    npx.setColor(5,0xff00ff);    
+    npx.setColor(6,0xffffff);    
+    npx.setColor(7,0x1f1f1f);
+    npx.show();    
+    wait(5.0);
+    
+    char* text = "INFORMATIK";
+ 
+    while(*text) {
+        setByte(*text++,0xff0000);
+        wait(1.0);
     }
+        
+        
 }
diff -r 14dc18aceca9 -r 1f676d6961e8 mbed.bld
--- a/mbed.bld	Wed Jun 07 13:16:58 2017 +0000
+++ b/mbed.bld	Mon Dec 11 12:55:19 2017 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/fb8e0ae1cceb
\ No newline at end of file