Pushbutton demo using internal pullup feature

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 DigitalOut myled(LED1);
00004 DigitalIn pb(p8);
00005 // SPST Pushbutton demo using internal PullUp function
00006 // no external PullUp resistor needed
00007 // Pushbutton from P8 to GND.
00008 int main() {
00009     pb.mode(PullUp);
00010     while(1) {
00011         myled = pb;
00012     }
00013 }