BLE Color Pixels based on nRF51822 and WS2812B

Dependencies:   BLE_API color_pixels mbed nRF51822

Fork of BLE_LCDDemo by Bluetooth Low Energy

Color pixels library using WS2812B and nRF51822 (16MHz)

http://www.seeedstudio.com/depot/bmz_cache/4/4f346dc15724a7b5a5c1383253aeefc9.image.530x397.jpg

/media/uploads/yihui/color_pixels.png

You can get the colorful led strip from seeed:

Click this link to download the color pixels app for android. The source code of the Android app is at https://github.com/Seeed-Studio/ble_color_pixels

If the BLE device is disconnected frequently, we can improve the stability by changing the BLE parameters - Advertising Duration (main.cpp), Min Interval and Max Interval (nRF51822/projectconfig.h)

#define CFG_GAP_CONNECTION_MIN_INTERVAL_MS           20                     /**< Minimum acceptable connection interval */
#define CFG_GAP_CONNECTION_MAX_INTERVAL_MS          200                     /**< Maximum acceptable connection interval */
Revision:
3:fc93699018c9
Parent:
2:20990b390374
Child:
4:3ce54cebbdc3
--- a/main.cpp	Fri Aug 01 07:07:12 2014 +0000
+++ b/main.cpp	Thu Aug 07 14:29:13 2014 +0000
@@ -37,10 +37,10 @@
 DigitalOut led1(LED1);
 
 // The Nordic UART Service
-static const uint8_t uart_base_uuid[] = {0x6e, 0x40, 0x00, 0x01, 0xb5, 0xa3, 0xf3, 0x93, 0xe0, 0xa9, 0xe5,0x0e, 0x24, 0xdc, 0xca, 0x9e};
-static const uint8_t uart_tx_uuid[]   = {0x6e, 0x40, 0x00, 0x02, 0xb5, 0xa3, 0xf3, 0x93, 0xe0, 0xa9, 0xe5,0x0e, 0x24, 0xdc, 0xca, 0x9e};
-static const uint8_t uart_rx_uuid[]   = {0x6e, 0x40, 0x00, 0x03, 0xb5, 0xa3, 0xf3, 0x93, 0xe0, 0xa9, 0xe5,0x0e, 0x24, 0xdc, 0xca, 0x9e};
-static const uint8_t uart_base_uuid_rev[] = {0x9e, 0xca, 0xdc, 0x24, 0x0e, 0xe5, 0xa9, 0xe0, 0x93, 0xf3, 0xa3, 0xb5, 0x01, 0x00, 0x40, 0x6e};
+const uint8_t uart_base_uuid[]     = {0x6e, 0x40, 0x00, 0x01, 0xb5, 0xa3, 0xf3, 0x93, 0xe0, 0xa9, 0xe5, 0x0e, 0x24, 0xdc, 0xca, 0x9e};
+const uint8_t uart_tx_uuid[]       = {0x6e, 0x40, 0x00, 0x02, 0xb5, 0xa3, 0xf3, 0x93, 0xe0, 0xa9, 0xe5, 0x0e, 0x24, 0xdc, 0xca, 0x9e};
+const uint8_t uart_rx_uuid[]       = {0x6e, 0x40, 0x00, 0x03, 0xb5, 0xa3, 0xf3, 0x93, 0xe0, 0xa9, 0xe5, 0x0e, 0x24, 0xdc, 0xca, 0x9e};
+const uint8_t uart_base_uuid_rev[] = {0x9e, 0xca, 0xdc, 0x24, 0x0e, 0xe5, 0xa9, 0xe0, 0x93, 0xf3, 0xa3, 0xb5, 0x01, 0x00, 0x40, 0x6e};
 
 bool rxPayloadUpdated = false;
 uint8_t rxPayload[20] = {0,};
@@ -111,22 +111,14 @@
 
     lcd.enableDisplay();
     lcd.clear();
-    fb.printString(lookupFontFace("DejaVu Serif", 8),
-                   20,
-                   40,
-                   BLACK,
-                   "Init");
+    fb.printString(lookupFontFace("DejaVu Serif", 8), 20, 40, BLACK, "Init");
     lcd.drawFrameBuffer(fb);
 
     while (true) {
         if (rxPayloadUpdated) {
             fb.clear();
             lcd.drawFrameBuffer(fb);
-            fb.printString(lookupFontFace("DejaVu Serif", 8),
-                           20,
-                           40,
-                           BLACK,
-                           (const char *)rxPayload);
+            fb.printString(lookupFontFace("DejaVu Serif", 8), 20, 40, BLACK, (const char *)rxPayload);
             lcd.drawFrameBuffer(fb);
 
             rxPayloadUpdated = false;