cy liang
/
blip_rainbow_mbed-os
blip_rainbow for Mbed OS 5.x
Diff: main.cpp
- Revision:
- 3:2d84c8262139
- Parent:
- 1:ca76237d2965
- Child:
- 4:ad1c22b1de40
--- 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); } }