Alberto Piganti
/
blip_rainbow
miniblip demo program
Fork of NeoPixel Demo by
Revision 3:2d84c8262139, committed 2015-11-26
- Comitter:
- pighixxx
- Date:
- Thu Nov 26 09:28:37 2015 +0000
- Parent:
- 2:b70964f8a427
- Commit message:
- miniblip demo program
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b70964f8a427 -r 2d84c8262139 main.cpp --- a/main.cpp Thu Mar 12 09:42:54 2015 +0000 +++ b/main.cpp Thu Nov 26 09:28:37 2015 +0000 @@ -1,8 +1,10 @@ +// miniblip led matrix demo + #include "mbed.h" #include "neopixel.h" -// This must be an SPI MOSI pin. -#define DATA_PIN p5 +// Matrix led output pin +#define DATA_PIN P0_9 void generate(neopixel::Pixel * out, uint32_t index, uintptr_t extra) { @@ -14,17 +16,28 @@ int main() { + // Turn off miniblip buzzer + PwmOut speaker(P0_8); + speaker=0.0; // Create a temporary DigitalIn so we can configure the pull-down resistor. - // (The mbed API doesn't provide any other way to do this.) - // An alternative is to connect an external pull-down resistor. DigitalIn(DATA_PIN, PullDown); // The pixel array control class. neopixel::PixelArray array(DATA_PIN); uint32_t offset = 0; + uint32_t i = 1; while (1) { - array.update(generate, 100, offset++); - wait_ms(250); + array.update(generate, 64, offset++); + + //Play Sound + float note=500+(i*100); + //speaker.period(1.0/note); + //speaker = float(i)/50.0; + + i++; + if (i>10) i=1; + // Rainbow delay + wait_ms(100); } }