this system is speed sensor for the human powered airplane by the pitot tube. the pitot tube is used the differential pressure senser SDP-1000.

Dependencies:   SDFileSystem mbed

Revision:
0:94c1e7624b95
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 13 11:38:55 2015 +0000
@@ -0,0 +1,71 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+
+
+SDFileSystem sd(p5, p6, p7, p8, "sd");
+AnalogIn  pitot(p18);
+
+DigitalOut  led1(LED1);
+DigitalOut  led2(LED2);
+DigitalOut  led3(LED3);
+DigitalOut  led4(LED4);
+DigitalIn   logging(p19);
+DigitalOut stop_counter(p20);
+PwmOut servo(p21);
+Timer t;
+
+float pout;
+double time_pulse, length, pres, vel;
+float sp_of_s;
+float  temp = 0;
+
+
+int main() {
+    led1 = 0.0;
+    led2 = 0.0;
+    led3 = 0.0;
+    led4 = 0.0;
+    wait(0.5);
+    
+    while(logging < 0.5) {
+        led1 = 1;
+        led4 = 1;
+        wait(0.5);
+        led1 = 0;
+        led4 = 0;
+        wait(0.5);
+        }
+        
+    wait(3);
+    //setup log file    
+    FILE *fp = fopen("/sd/TFLOG.csv", "w");
+    if(fp == NULL) {
+        error("Could not open file for write\n\r");
+        }
+        
+    fprintf(fp, "altitude, velocity\n");    
+    stop_counter = 0;
+    led1 = 1;
+    led4 = 1;
+    
+    while(logging < 0.5){
+        //get velocity
+        pres = 500 * (pitot.read()*5-0.25)/3.75*0.95-15.5;
+            
+            if(pres > 0){
+                vel=sqrt(2.0/1.225*pres);
+            }
+            else{
+            vel=-sqrt(2.0/1.225*pres*(-1.0));
+            }
+        
+        fprintf(fp,"%6.4f\n ", vel);
+        //servo.pulsewidth(pout);
+        //wait(0.04888-time_pulse/1000000);
+        wait(0.01);
+    }
+    stop_counter = 1;
+    fclose(fp);
+    led1 = 0;
+    led4 = 0;
+}