From eb16b2e4a0a9d73ab689106818760516085f2029 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 15 Mar 2017 17:16:34 +0700 Subject: [PATCH] finish neomatrix example --- .../Peripheral/neomatrix/neomatrix.ino | 25 ++++++++++++++++--- .../examples/Peripheral/neopixel/neopixel.ino | 12 +++++++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/neomatrix/neomatrix.ino b/libraries/Bluefruit52Lib/examples/Peripheral/neomatrix/neomatrix.ino index e039306c..4b003291 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/neomatrix/neomatrix.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/neomatrix/neomatrix.ino @@ -12,9 +12,16 @@ any redistribution *********************************************************************/ -// This sketch is intended to be used with the NeoPixel control -// surface in Adafruit's Bluefruit LE Connect mobile application. - +/* How to run this sketch + * - Connect Neopixel FeatherWing and Load sketch to Bluefruit52 + * - Connect using Bluefruit Connect LE app + * - Send character using BLEUART + * - Bluefruit will draw received character on Neopixel FeatherWing + * + * Note: due to the font is larger than 4x8 Neopixel Wing, you can + * only see part of the characters (but you got the idea). + * Run the sketch with larger Neopixel Matrix for complete demo + */ #include #include #include @@ -58,8 +65,11 @@ void setup() { Serial.begin(115200); Serial.println(F("Adafruit Bluefruit NeoMatrix")); - Serial.println(F("------------------------------------")); + Serial.println(F("----------------------------")); + Serial.println(); + Serial.println("Please connect using Bluefruit Connect LE application"); + // Config Neopixels Matrix matrix.begin(); matrix.setTextWrap(false); @@ -69,6 +79,7 @@ void setup() // Init Bluefruit Bluefruit.begin(); Bluefruit.setName("Bluefruit52"); + Bluefruit.setConnectCallback(connect_callback); // Configure and Start Device Information Service bledis.setManufacturer("Adafruit Industries"); @@ -99,6 +110,12 @@ void setupAdv(void) Bluefruit.ScanResponse.addName(); } +void connect_callback(void) +{ + Serial.println("Connected ! Please select 'Uart' tab and send any characters"); +} + + void loop() { // Echo received data diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/neopixel/neopixel.ino b/libraries/Bluefruit52Lib/examples/Peripheral/neopixel/neopixel.ino index b351100c..0a40b247 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/neopixel/neopixel.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/neopixel/neopixel.ino @@ -37,15 +37,19 @@ BLEUart bleuart; void setup() { Serial.begin(115200); - Serial.println(F("Adafruit Bluefruit Neopixel Test")); - Serial.println(F("------------------------------------")); + Serial.println("Adafruit Bluefruit Neopixel Test"); + Serial.println("------------------------------------"); + Serial.println(); + Serial.println("Please connect using Bluefruit Connect LE application"); + // Config Neopixels pixels.begin(); // Init Bluefruit Bluefruit.begin(); Bluefruit.setName("Bluefruit52"); + Bluefruit.setConnectCallback(connect_callback); // Configure and Start Device Information Service bledis.setManufacturer("Adafruit Industries"); @@ -76,6 +80,10 @@ void setupAdv(void) Bluefruit.ScanResponse.addName(); } +void connect_callback(void) +{ + Serial.println("Connected !! Please select 'Neopixles' tab, click 'Connect' and have fun"); +} void loop() {