![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
led
Dependencies: mbed PixelArray
Revision 3:7559835b072a, committed 2019-06-13
- Comitter:
- clementlignie
- Date:
- Thu Jun 13 14:58:56 2019 +0000
- Parent:
- 2:b70964f8a427
- Commit message:
- leds
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b70964f8a427 -r 7559835b072a main.cpp --- a/main.cpp Thu Mar 12 09:42:54 2015 +0000 +++ b/main.cpp Thu Jun 13 14:58:56 2019 +0000 @@ -2,16 +2,34 @@ #include "neopixel.h" // This must be an SPI MOSI pin. -#define DATA_PIN p5 +#define DATA_PIN p11 -void generate(neopixel::Pixel * out, uint32_t index, uintptr_t extra) +DigitalIn BPA(p17); +DigitalIn BPB(p18); + +void generateTourne(neopixel::Pixel * out, uint32_t index, uintptr_t extra) { - uint32_t brightness = (index + extra) >> 3; + uint32_t brightness = 100; out->red = ((index + extra) & 0x1) ? brightness : 0; out->green = ((index + extra) & 0x2) ? brightness : 0; out->blue = ((index + extra) & 0x4) ? brightness : 0; } +void generateRouge(neopixel::Pixel * out, uint32_t index, uintptr_t extra) +{ + uint32_t brightness = 100; + out->red = 255; + out->green = 0; + out->blue = 0; +} +void generateVert(neopixel::Pixel * out, uint32_t index, uintptr_t extra) +{ + uint32_t brightness = 100; + out->red = 0; + out->green = 255; + out->blue = 0; +} + int main() { // Create a temporary DigitalIn so we can configure the pull-down resistor. @@ -24,7 +42,18 @@ uint32_t offset = 0; while (1) { - array.update(generate, 100, offset++); + + if (!(BPA)){ + array.update(generateVert, 100, offset++); + wait(5); + } + if (!(BPB)){ + array.update(generateRouge, 100, offset++); + wait(5); + } + //if ((BPA == 1)&&(BPB == 1)) + array.update(generateTourne, 100, offset++); + wait_ms(250); } }