![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
lab question 3
main.cpp
- Committer:
- niallmoyvane
- Date:
- 2019-05-21
- Revision:
- 0:52c0110393c4
File content as of revision 0:52c0110393c4:
#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); } }