FSLP_Serial_Output
Diff: main.cpp
- Revision:
- 0:7d0912a942ad
diff -r 000000000000 -r 7d0912a942ad main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Oct 20 17:49:32 2015 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+Serial pc(USBTX, USBRX);
+
+DigitalInOut pinReference(p13);
+DigitalOut driveLine2(p14);
+AnalogIn senseLine3(p15);
+
+
+int main() {
+ while(1) {
+ /** output() is used to set the pin reference as an output pin and set it to ground */
+ pinReference.output();
+ pinReference = 0;
+ driveLine2 = 1;
+ float force = 0;
+ /** read()is used to read in force */
+ force = senseLine3.read();
+ wait(0.001);
+ /** input() is used to set the pin reference as an input */
+ pinReference.input();
+ driveLine2 = 0;
+ float position = 0;
+ /** read() is used to read in position */
+ position = senseLine3.read();
+ pc.printf("Force: %f", force);
+ pc.printf(" Position: %f\r\n", position);
+ wait(1);
+
+ }
+}
+
+
Force Sensing Linear Potentiometer