Pushbutton demo using internal pullup feature

Dependencies:   mbed

Committer:
4180_1
Date:
Tue Sep 20 13:52:11 2011 +0000
Revision:
0:0cc4122581e7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 0:0cc4122581e7 1 #include "mbed.h"
4180_1 0:0cc4122581e7 2
4180_1 0:0cc4122581e7 3 DigitalOut myled(LED1);
4180_1 0:0cc4122581e7 4 DigitalIn pb(p8);
4180_1 0:0cc4122581e7 5 // SPST Pushbutton demo using internal PullUp function
4180_1 0:0cc4122581e7 6 // no external PullUp resistor needed
4180_1 0:0cc4122581e7 7 // Pushbutton from P8 to GND.
4180_1 0:0cc4122581e7 8 int main() {
4180_1 0:0cc4122581e7 9 pb.mode(PullUp);
4180_1 0:0cc4122581e7 10 while(1) {
4180_1 0:0cc4122581e7 11 myled = pb;
4180_1 0:0cc4122581e7 12 }
4180_1 0:0cc4122581e7 13 }