チャタリングのテスト用プログラム

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
yueee_yt
Date:
Wed May 11 08:07:43 2011 +0000
Commit message:

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Wed May 11 08:07:43 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 11 08:07:43 2011 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+DigitalOut led(LED1);
+DigitalIn  sw(p20);
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
+Ticker timer;
+int i=0;
+
+void tick(void)
+{
+    lcd.cls();
+    lcd.printf(" %d ",i);
+    if(sw.read()==0)led=1; else led=0;
+}
+
+int main() {
+    int ssw=1;
+    sw.mode(PullUp);
+    timer.attach(&tick, 0.1);
+   
+    while(1) {
+        if(sw.read()==1){
+            if(ssw==0){
+                ssw=1;
+            }
+        }else{
+            if(ssw==1){
+                i++;
+                ssw=0;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 11 08:07:43 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912