Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 Serial pc(USBTX, USBRX); 00003 00004 DigitalInOut pinReference(p13); 00005 DigitalOut driveLine2(p14); 00006 AnalogIn senseLine3(p15); 00007 00008 00009 int main() { 00010 while(1) { 00011 /** output() is used to set the pin reference as an output pin and set it to ground */ 00012 pinReference.output(); 00013 pinReference = 0; 00014 driveLine2 = 1; 00015 float force = 0; 00016 /** read()is used to read in force */ 00017 force = senseLine3.read(); 00018 wait(0.001); 00019 /** input() is used to set the pin reference as an input */ 00020 pinReference.input(); 00021 driveLine2 = 0; 00022 float position = 0; 00023 /** read() is used to read in position */ 00024 position = senseLine3.read(); 00025 pc.printf("Force: %f", force); 00026 pc.printf(" Position: %f\r\n", position); 00027 wait(1); 00028 00029 } 00030 } 00031 00032
Generated on Sun Jul 17 2022 21:05:12 by
1.7.2
Force Sensing Linear Potentiometer