![](/media/cache/profiles/dream_vangogh.jpg.50x50_q85.jpg)
blinky example for NXP rapid IoT prototyping kit https://www.nxp.com/design/designs/nxp-rapid-iot-prototyping-kit:IOT-PROTOTYPING Read more at https://www.hackster.io/marcomerli/riotwear-mbed-2b2011
This is the blinky example for NXP rapid IoT prototyping kit, based on the hexiwear mbed platform. https://www.nxp.com/design/designs/nxp-rapid-iot-prototyping-kit:IOT-PROTOTYPING
Revision 79:0431b9fd3dc0, committed 2019-11-23
- Comitter:
- batman52
- Date:
- Sat Nov 23 18:03:20 2019 +0000
- Parent:
- 78:ddf5cff958fa
- Commit message:
- added green led
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Nov 20 21:33:47 2019 +0000 +++ b/main.cpp Sat Nov 23 18:03:20 2019 +0000 @@ -1,14 +1,32 @@ #include "mbed.h" -DigitalOut led_red(LED_RED, 1); // LED1 = LED_RED, 1 --> OFF, 0 --> ON -DigitalOut led_blue(LED_BLUE, 1); // LED3 = LED_BLUE, 1 --> OFF, 0 --> ON +DigitalOut rgb_red(LED_RED, 1); // LED1 = LED_RED, 1 --> OFF, 0 --> ON +DigitalOut rgb_blue(LED_BLUE, 1); // LED3 = LED_BLUE, 1 --> OFF, 0 --> ON +DigitalOut rgb_green(PTE7,1); // 1 --> OFF, 0 --> ON + +void rgb_sel(int8_t idx) { + +switch(idx) { + case 0: + rgb_red = 0; rgb_blue=1; rgb_green = 1; + break; + case 1: + rgb_red = 1; rgb_blue=0; rgb_green = 1; + break; + case 2: + rgb_red = 1; rgb_blue=1; rgb_green = 0; + break; + } + +} // main() runs in its own thread in the OS int main() { + int idx; while (true) { - led_red = !led_red; - led_blue = !led_red; - wait(0.5); + for(idx=0;idx<3;idx++) { + rgb_sel(idx); + wait(0.5); + } } -} - +} \ No newline at end of file