A digital input monitoring implementation with busy wait.

main.cpp

Committer:
sarahmarshy
Date:
2016-09-26
Revision:
0:c27624b8b1e0

File content as of revision 0:c27624b8b1e0:

#include "mbed.h"
#include "rtos.h"
 
DigitalIn button(SW1); // Change to match your board
DigitalOut led(LED1);

#define button_press 0

int main() {
    while(1) {
        if(button_press == button){
           led = !led;
           wait(1);
       }
    }
}