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.
Dependencies: RedBearNano_NeoPixels
Revision 0:41668480cbeb, committed 2018-02-02
- Comitter:
- kuehn
- Date:
- Fri Feb 02 12:09:22 2018 +0000
- Commit message:
- First running version
Changed in this revision
| NeoPixels.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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NeoPixels.lib Fri Feb 02 12:09:22 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/bickster/code/RedBearNano_NeoPixels/#bb19df120222
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Feb 02 12:09:22 2018 +0000
@@ -0,0 +1,70 @@
+#include "mbed.h"
+
+#include "neopixel.h"
+
+#define NRF51_DONGLE
+
+#define LED_COUNT 15
+
+#ifdef NRF51_DONGLE
+ #define LED_0 p21
+ #define LED_1 p23
+ #define LED_2 p22
+
+ #define STRIP_0 p15
+ #define STRIP_1 p16
+
+ #define PULSE_0 p17
+
+#elif NRF51_MICROBIT
+ #define LED_0 p18
+ #define LED_1 p19
+#endif
+
+DigitalOut myled_0(LED_0);
+DigitalOut myled_1(LED_1);
+
+DigitalOut myledError(LED_2);
+
+neopixel_strip_t m_strip;
+uint8_t dig_pin_num = 15;
+uint8_t leds_per_strip = 24;
+uint8_t result;
+
+uint8_t current = 0;
+
+//clear and remove strip
+// neopixel_clear(&m_strip);
+// neopixel_destroy(&m_strip);
+
+void renderLine()
+{
+ result = neopixel_set_color_and_show(&m_strip, current, 0x22, 0xAA, 0x88);
+
+ current = (current + 1) % LED_COUNT;
+
+ if (result) {
+ myledError = 1;
+ }
+ else {
+ myledError = 0;
+ }
+}
+
+int main ()
+{
+ neopixel_init(&m_strip, STRIP_0, LED_COUNT);
+ neopixel_clear(&m_strip);
+
+ while (1) {
+ myled_0 = 1;
+ myled_1 = 0;
+ wait (0.2);
+
+ myled_0 = 0;
+ myled_1 = 1;
+ wait (0.2);
+
+ renderLine();
+ }
+}
\ No newline at end of file