FSLP_Serial_Output
main.cpp
- Committer:
- sethnuon
- Date:
- 2015-10-20
- Revision:
- 0:7d0912a942ad
File content as of revision 0:7d0912a942ad:
#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); } }