温度に応じて、ポートをON/OFFするプログラムです。

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jksoft
Date:
Sun Aug 19 15:49:56 2012 +0000
Commit message:
Rev1

Changed in this revision

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/main.cpp	Sun Aug 19 15:49:56 2012 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+
+#define ON_SET 28.0
+#define OFF_SET 26.0
+
+AnalogIn ain(p15);
+DigitalOut usbsw(p5);
+
+int main() {
+    float tmp;
+    while(1)
+    {
+      //  tmp = (ain - 0.1818)/0.00303;
+        tmp = ain * 3.3 * 100.0;
+      
+        printf("tmp=%f\t",tmp);
+        
+        if(tmp > ON_SET)
+        {
+            usbsw = 1;
+            printf("SW ON");
+        }
+        else if(tmp < OFF_SET)
+        {
+            usbsw = 0;
+            printf("SW OFF");
+        }
+        else
+        {
+        
+        }
+        printf("\r\n");
+
+        wait(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Aug 19 15:49:56 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6
\ No newline at end of file