Use this to read potentiometer value
Dependencies: mbed
Revision 0:dd5527fbf101, committed 2016-11-22
- Comitter:
- HaisongDong
- Date:
- Tue Nov 22 02:47:57 2016 +0000
- Commit message:
- Read potentiometer for debug
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r dd5527fbf101 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 22 02:47:57 2016 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" + +PwmOut myled(LED1); +AnalogIn mypotentiometer(p19); +Serial pc(USBTX, USBRX); + +int main() +{ + pc.baud(115200); + myled.period(0.020f); + while(1) { + myled = mypotentiometer; + pc.printf("%f \n\r", mypotentiometer.read()); + wait(0.1); + } +} \ No newline at end of file
diff -r 000000000000 -r dd5527fbf101 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 22 02:47:57 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf \ No newline at end of file