Felix Pachay / Mbed 2 deprecated tarea on-led

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  
00003 // LED connected Pin PC_0
00004 DigitalOut led(PC_0);
00005  
00006 // Push-Button connected Pin PC_3
00007 DigitalIn pushButton(PC_3);
00008  
00009 // Main Loop runs in its own thread in the OS
00010 int main() {
00011  
00012    // Active Pull-Up Resistor
00013    pushButton.mode(PullUp);
00014  
00015    // Inifite Loop
00016    while(1) {
00017  
00018       // Check Push-Button
00019       if(pushButton == 0) {
00020  
00021          // LED Turn-On
00022          led = 1;
00023  
00024       } else {
00025  
00026          // LED Turn-Off
00027          led = 0;
00028       }
00029    }
00030 }
00031 
00032 
00033 
00034