Fábio Souza
/
KL46Z_EX2
Example 2 Hands on KL46
Fork of CPBR_KL46Z_EX2 by
Revision 1:6fb8c2aaffb7, committed 2017-05-19
- Comitter:
- FBSEletronica
- Date:
- Fri May 19 21:05:12 2017 +0000
- Parent:
- 0:f8a09a4ee6c9
- Commit message:
- Example 2 Hands on KL46
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f8a09a4ee6c9 -r 6fb8c2aaffb7 main.cpp --- a/main.cpp Tue Jan 31 19:04:11 2017 +0000 +++ b/main.cpp Fri May 19 21:05:12 2017 +0000 @@ -1,27 +1,17 @@ #include "mbed.h" -DigitalOut led_red(LED2); -DigitalOut led_green(LED1); -DigitalIn sw1(SW1); -DigitalIn sw3(SW3); +DigitalOut led_green(LED1); // LED Green-> PTD5 -> LED1 +DigitalIn sw1(SW1); //SW1 - >PTC3 -> SW1 + +int main(){ - -int main() { - - led_red = 1; - led_green = 1; + led_green = 1; //turn off LED while (true) { - if(sw1 == 0){ //se botão pressionada - led_red = 0; //liga o led - }else{ //se não - led_red = 1; //apaga o led - } - - if(sw3 == 0){ //se botão pressionada - led_green = 0; //liga o led - }else{ //se não - led_green = 1; //apaga o led + if(sw1 == 0){ //if button is pressed + led_green = 0; //turn on LED + }else{ //if button isn't pressed + led_green = 1; //turn off LED } } }