MTU COMP71004 Summer 2021 / Mbed 2 deprecated lect7_1

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 AnalogIn p1(p19);       //pot1 
00004 
00005 int main() {
00006     while(1) {
00007         float p1_float = p1;    // read pot1 value
00008         float p1_volts = p1_float * 3.3;    // convert analog value to voltage
00009         printf("float: %f volts: %f \r\n",p1_float, p1_volts);
00010         wait(3);  
00011     }
00012 }