Intermittent Stimuli

Dependencies:   mbed tsi_sensor

Files at this revision

API Documentation at this revision

Comitter:
franciscoguerra
Date:
Thu Jan 14 16:02:26 2016 +0000
Parent:
5:79a16c0a88c1
Commit message:
Intermittent Stimuli

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
tsi_sensor.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 79a16c0a88c1 -r 1f29b4f65251 main.cpp
--- a/main.cpp	Tue Feb 19 23:49:45 2013 +0000
+++ b/main.cpp	Thu Jan 14 16:02:26 2016 +0000
@@ -1,19 +1,66 @@
-#include "mbed.h"
-
-Ticker tick;
-DigitalOut led1(LED_RED);
-DigitalOut led2(LED_GREEN);
-
-void flip() {
-    led2 = !led2;
-}
-
-int main() {
-    tick.attach(&flip, 0.7); // setup ticker to call flip led2 after 0.7 seconds
-
-    // spin in a main loop.
-    while (true) {
-        led1 = !led1;
-        wait (0.3); // flip led1 every 0.3 seconds
-    }
-}
\ No newline at end of file
+#include "mbed.h"
+//#include "FastPWM.h"
+#include "tsi_sensor.h"
+
+#define V1_CLOSE  D2
+#define V1_OPEN   D3
+#define V2_CLOSE  D4
+#define V2_OPEN   D5
+#define V3_CLOSE  A2
+#define V3_OPEN   A3
+#define V4_CLOSE  D8
+#define V4_OPEN   D9
+#define EXTERNAL1_td PTC2
+#define EXTERNAL2_td PTB1
+
+//#define TSI_A PTB16
+//#define TSI_B PTB17
+
+Ticker flipper;
+//PwmOut v1open(V1_OPEN);
+//PwmOut v1close(V1_CLOSE);
+//TSIAnalogSlider slider(TSI_A, TSI_B, 100);
+
+DigitalOut v2open(V2_OPEN);
+DigitalOut v2close(V2_CLOSE);
+DigitalOut v1open(V1_OPEN);
+DigitalOut v1close(V1_CLOSE);
+
+AnalogIn ain1_td(EXTERNAL1_td);
+AnalogIn ain2_td(EXTERNAL2_td);
+
+//void flip() {
+   // v1open = !v1open;
+//}
+
+int main() {
+    
+    //flipper.attach(&flip, 2); // the address of the function to be attached (flip) and the interval (2 seconds)
+    // spin in a main loop. flipper will interrupt it to call flip
+    
+    while (true){
+    v1open = 0;
+    v1close =1;
+    v2open = 0;
+    v2close =1;
+            //Front balloon settings
+            while (ain1_td.read()>0.001) {
+                v1open = !v1open; //Inflation;
+                v1close = !v1close; 
+                wait(0.025); //Inflation time;
+                v1close = !v1close;//Deflation;
+                v1open = !v1open;
+                wait(ain1_td.read()); //Defines frequency(reads the frequency settings for front balloon defined in LabVIEW);
+            } 
+            //Back balloon settings
+            while (ain2_td.read()>0.001) {
+                v2open = !v2open;//Inflation;
+                v2close = !v2close;
+                wait(0.025); //Inflation time;
+                v2close = !v2close;//Deflation;
+                v2open = !v2open;
+                wait(ain2_td.read());//Defines frequency(reads the frequency settings for back balloon defined in LabVIEW);
+            } 
+    }
+}
+ 
\ No newline at end of file
diff -r 79a16c0a88c1 -r 1f29b4f65251 mbed.bld
--- a/mbed.bld	Tue Feb 19 23:49:45 2013 +0000
+++ b/mbed.bld	Thu Jan 14 16:02:26 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/3d0ef94e36ec
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7
\ No newline at end of file
diff -r 79a16c0a88c1 -r 1f29b4f65251 tsi_sensor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsi_sensor.lib	Thu Jan 14 16:02:26 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Kojto/code/tsi_sensor/#976904559b5c