Timo de Vries
/
leds_test
push buttons to control the leds
Revision 0:026e533b2f2f, committed 2016-09-12
- Comitter:
- Frostworks
- Date:
- Mon Sep 12 09:55:09 2016 +0000
- Commit message:
- push buttons to control the leds
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 12 09:55:09 2016 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" +#include "math.h" + +DigitalOut gpo(D0); +DigitalOut led_g(LED_GREEN); +DigitalOut led_b(LED_BLUE); +DigitalOut led_r(LED_RED); +DigitalIn sw3 (SW3); +DigitalIn sw2(SW2); + +int main() +{ + while (true) { + gpo = !gpo; // toggle pin + led_g = 1; + led_b = 1; + led_r = 1; + + if (sw2 == 0) + { + led_g = 1; + led_b = 0; + led_r = 1; + } + if (sw3 == 0) + { + led_g = 1; + led_b = 1; + led_r = 0; + } + if ((sw2==0)&&(sw3==0)) + { + led_g = 0; + led_b = 1; + led_r = 1; + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Sep 12 09:55:09 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/2e9cc70d1897 \ No newline at end of file