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.
Dependencies: mbed
main.cpp
- Committer:
- kinii
- Date:
- 2021-07-13
- Revision:
- 1:66c794ac87fa
- Parent:
- 0:e36fb7e4cd89
File content as of revision 1:66c794ac87fa:
#include "mbed.h"
AnalogIn p1(p17); //different pin - i.e. unconnected
AnalogOut o1(p18);
int main() {
while(1) {
for(int i=0; i<10; i++){
printf("for loop i=%d \r\n", i);
o1 = i/10; // applying analoginput...
// physically connect a wire btween p1 and o1
wait(1);
float p1_float = p1; // read pot1 value
float p1_volts = p1_float * 3.3; // convert analog value to voltage
printf("float: %f volts: %f \r\n",p1_float, p1_volts);
wait(3);
}
}
}