niall behan
/
lab_question3
lab question 3
Revision 0:52c0110393c4, committed 2019-05-21
- Comitter:
- niallmoyvane
- Date:
- Tue May 21 12:00:33 2019 +0000
- Commit message:
- lab question 3
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 52c0110393c4 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 21 12:00:33 2019 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" + +PwmOut red(p23); +PwmOut green(p24); +AnalogIn pot1(p19); +AnalogIn pot2(p20); +Serial pc(USBTX,USBRX); + +float a,b; + + int main() + { + while(1) + { + a=pot1*100; //the value requires to be multiplied by 100 + red=pot1; + + b=pot2*100; //in order to get the percentage + green=pot2; + + pc.printf("Pot 1 position is: %3f\n\r",a); + wait(2); + + pc.printf("Pot 2 position is: %3f\n\r",b); + wait(2); + } + } + \ No newline at end of file
diff -r 000000000000 -r 52c0110393c4 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 21 12:00:33 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file