Embedded system Fun Blog
























































Find out all the best information, libraries and circuit about the latest Embedded systems.

Saturday 7 January 2012

MBED Example: How to use analog input pin (ADC, AnalogIn)

.from: http://mbed.org/projects/libraries/svn/mbed/trunk/AnalogIn.h

// Print messages when the AnalogIn is greater than 50%

#include "mbed.h"

AnalogIn temperature(p20);

int main() {
 while(1) {
     if(temperature > 0.5) {
         printf("Too hot! (%f)", temperature.read());            
     }
 }
}

No comments:

Post a Comment