M0Board_WF
/
WF_RGB_Taster_V2
a
Revision 0:628a777a56a7, committed 2015-01-28
- Comitter:
- bulmenwt
- Date:
- Wed Jan 28 07:53:02 2015 +0000
- Commit message:
- a
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM75B.lib Wed Jan 28 07:53:02 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/neilt6/code/LM75B/#7ac462ba84ac
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jan 28 07:53:02 2015 +0000 @@ -0,0 +1,49 @@ +/*M0-BOARD LPC11U24 VERSION 1.0 WF 01_2015 +BULME Graz / Elektronik +RGB - LED +Datei: WF_RGB_Taster_V2/main.cpp +*/ + +#include "mbed.h" +PwmOut g(p5); // Definition LED grün, PWM +PwmOut b(p34); // Definition LED blau, PWM +PwmOut r(p36); // Definition LED rot, PWM + +// Definition der Taster (Switches) +DigitalIn sw1(P0_15); // SW1 -> sein IO Pin ist laut Schaltplan der P0_15 +DigitalIn sw2(P0_10); // Die Pins werden hier mit DigitalIn belegt ! +DigitalIn sw3(P0_23); // Die Pins werden hier mit DigitalIn belegt ! + +int main() +{ + int code; + while(1) + { + code = (sw3 * 4) + (sw2 * 2) + (sw1); //binary encoded buttons + switch (code) { + case 1: + g=0; // LED on + b=1; // LED off + r=1; // LED off + break; + + case 2: + g=1; // LED off + b=0; // LED on + r=1; // LED off + break; + + case 4: + g=1; // LED off + b=1; // LED off + r=0; // LED on + break; + + default: + g=1; // LED on + b=1; // LED off + r=1; // LED of + break; + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jan 28 07:53:02 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file