Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DebounceIn mbed
Diff: main.cpp
- Revision:
- 1:0a9d678c6d6c
- Parent:
- 0:74d1c03b0439
--- a/main.cpp Mon Nov 16 12:29:51 2015 +0000
+++ b/main.cpp Mon Nov 16 13:33:56 2015 +0000
@@ -4,25 +4,27 @@
DigitalOut l2(LED2);
DigitalOut l3(LED3);
DigitalOut l4(LED4);
-DebounceIn pb(p8);
+//DebounceIn pb(p8);
// SPST Pushbutton demo using internal PullUp function
// no external PullUp resistor needed
// Pushbutton from P8 to GND.
int main() {
int count=0;
- int old_pb=1;
- int new_pb;
- pb.mode(PullUp);
- wait(0.01);
+// int old_pb=1;
+// int new_pb;
+// pb.mode(PullUp);
+// wait(0.01);
while(1) {
- new_pb = pb;
- if((new_pb == 0) & (old_pb ==1))
- count++;
+ // new_pb = pb;
+// if((new_pb == 0) & (old_pb ==1))
+// count++;
l4 = count & 0x01;
l3 = (count & 0x02) >> 1;
l2 = (count & 0x04) >> 2;
l1 = (count & 0x08) >> 3;
- old_pb = new_pb;
+ wait(1.0);
+ count++;
+// old_pb = new_pb;
}
}
\ No newline at end of file