Pushbutton demo using internal pullup feature
Diff: main.cpp
- Revision:
- 0:0cc4122581e7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Sep 20 13:52:11 2011 +0000
@@ -0,0 +1,13 @@
+#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;
+ }
+}