Pushbutton demo using internal pullup feature

Dependencies:   mbed

main.cpp

Committer:
4180_1
Date:
2011-09-20
Revision:
0:0cc4122581e7

File content as of revision 0:0cc4122581e7:

#include "mbed.h"

DigitalOut myled(LED1);
DigitalIn pb(p8);
// SPST Pushbutton demo using internal PullUp function
// no external PullUp resistor needed
// Pushbutton from P8 to GND.
int main() {
    pb.mode(PullUp);
    while(1) {
        myled = pb;
    }
}