First draft

Dependencies:   MS5607 mbed

Files at this revision

API Documentation at this revision

Comitter:
rranisz1
Date:
Mon Feb 12 22:46:06 2018 +0000
Commit message:
v1.0.0; ; altimeter based flight computer

Changed in this revision

MS5607.lib Show annotated file Show diff for this revision Revisions of this file
Rocket-01.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
diff -r 000000000000 -r 4d32261c32e5 MS5607.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MS5607.lib	Mon Feb 12 22:46:06 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/yamaguch/code/MS5607/#5760862143d1
diff -r 000000000000 -r 4d32261c32e5 Rocket-01.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Rocket-01.cpp	Mon Feb 12 22:46:06 2018 +0000
@@ -0,0 +1,74 @@
+#include "mbed.h"
+#include "MS5607I2C.h"
+
+DigitalOut cutter[] = {(PD8), (PD13)};
+
+int Alt0 ;
+int Alt1 ;
+MS5607I2C ms5607(PE0, PE1, false);
+
+
+
+enum alt_States {Setup, Launchpad, Flight, Deployment};
+alt_States current = Setup;
+
+float get_Avg()
+{
+    float sum_a = 0.0;
+    int iterations = 5;
+    for(int i = 0; iterations<5; i++) {
+        sum_a += ms5607.getAltitude();
+        wait_ms(10);
+    }
+    return sum_a / iterations;
+}
+
+int currAlt = get_Avg();
+
+
+int main()
+{
+
+    switch(current) {
+        case Setup: {
+
+            wait(600);
+            Alt0 = currAlt;
+            current = Launchpad;
+        }
+        break;
+
+        case Launchpad: {
+
+            int Alt1 = currAlt;
+            wait(5);
+            if(Alt1 >> Alt0+100) {
+                current = Flight;
+                break;
+            }
+            Alt0 = Alt1;
+        }
+        break;
+
+        case Flight: {
+            wait(1);
+            if(currAlt << Alt1) {
+                current = Deployment;
+                break;
+            }
+            Alt1 = currAlt;
+        }
+        break;
+
+        case Deployment: {
+            cutter[1] = 1;
+            cutter[2] = 1;
+            break;
+        }
+
+
+
+
+    }
+}
+
diff -r 000000000000 -r 4d32261c32e5 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 12 22:46:06 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e
\ No newline at end of file