An example program showing how to use the Potentiometer on the Embedded Artists baseboard

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 // Potentionmeter is on mbed p15
00004 // Ensure J27 is fitted
00005 
00006 AnalogIn pot (p15);
00007 
00008 Serial pc (USBTX,USBRX);
00009 
00010 int main() {
00011     while(1) {
00012         float ain = pot;
00013         pc.printf("Analog pot voltage = %.2fv\n",ain*3.3);
00014         wait(0.2);
00015     }
00016 }