LPC8xx Internal Analog Comparator

Dependencies:   ACMP mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ACMP.h"
00003 
00004 DigitalOut led1(LED1), led2(LED2);
00005 ACMP acmp(ACMP::ACMP_I1, ACMP::LADDER, ACMP::HYS5mV, 16);
00006 
00007 /*
00008 void isr_rise () {
00009     led2 = 1;
00010 }
00011 void isr_fall () {
00012     led2 = 0;
00013 }
00014 */
00015 
00016 int main() {
00017 /*
00018     acmp.rise(&isr_rise);
00019     acmp.fall(&isr_fall);
00020 */
00021     while(1) {
00022         led1 = !led1;
00023         led2 = acmp.read();
00024         wait(0.2);
00025     }
00026 }