FSLP_Serial_Output
Revision 0:7d0912a942ad, committed 2015-10-20
- Comitter:
- sethnuon
- Date:
- Tue Oct 20 17:49:32 2015 +0000
- Commit message:
- FSLP Serial Output
Changed in this revision
main.cpp | 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 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); + + } +} + +