FSLP Window USB Serial Output
main.cpp@0:3d977c006001, 2015-10-20 (annotated)
- Committer:
- sethnuon
- Date:
- Tue Oct 20 00:07:54 2015 +0000
- Revision:
- 0:3d977c006001
FSLP
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sethnuon | 0:3d977c006001 | 1 | #include "mbed.h" |
sethnuon | 0:3d977c006001 | 2 | Serial pc(USBTX, USBRX); |
sethnuon | 0:3d977c006001 | 3 | |
sethnuon | 0:3d977c006001 | 4 | DigitalInOut pinReference(p13); |
sethnuon | 0:3d977c006001 | 5 | DigitalOut driveLine2(p14); |
sethnuon | 0:3d977c006001 | 6 | AnalogIn senseLine3(p15); |
sethnuon | 0:3d977c006001 | 7 | |
sethnuon | 0:3d977c006001 | 8 | |
sethnuon | 0:3d977c006001 | 9 | int main() { |
sethnuon | 0:3d977c006001 | 10 | while(1) { |
sethnuon | 0:3d977c006001 | 11 | pinReference.output(); |
sethnuon | 0:3d977c006001 | 12 | pinReference = 0; |
sethnuon | 0:3d977c006001 | 13 | driveLine2 = 1; |
sethnuon | 0:3d977c006001 | 14 | float force = 0; |
sethnuon | 0:3d977c006001 | 15 | force = senseLine3.read(); |
sethnuon | 0:3d977c006001 | 16 | wait(0.001); |
sethnuon | 0:3d977c006001 | 17 | pinReference.input(); |
sethnuon | 0:3d977c006001 | 18 | driveLine2 = 0; |
sethnuon | 0:3d977c006001 | 19 | float position = 0; |
sethnuon | 0:3d977c006001 | 20 | position = senseLine3.read(); |
sethnuon | 0:3d977c006001 | 21 | pc.printf("Force: %f", force); |
sethnuon | 0:3d977c006001 | 22 | pc.printf(" Position: %f\r\n", position); |
sethnuon | 0:3d977c006001 | 23 | wait(1); |
sethnuon | 0:3d977c006001 | 24 | |
sethnuon | 0:3d977c006001 | 25 | } |
sethnuon | 0:3d977c006001 | 26 | } |
sethnuon | 0:3d977c006001 | 27 | |
sethnuon | 0:3d977c006001 | 28 |