ADC TEST CODE of LPC1114FN28

Dependencies:   mbed

main.cpp

Committer:
iqOyOpi
Date:
2013-09-14
Revision:
0:87a098bea248

File content as of revision 0:87a098bea248:

#include "mbed.h"
float threshold =   0.5;  // 閾値
float val;
AnalogIn Val(dp13);     // ポテンショメータのワイプ(中央の端子)に
                        // 両端はグランドと+5Vに接続
DigitalOut myled(LED1);
Serial pc(dp16,dp15);

int main() {
    pc.baud(115200);
    pc.printf("LPC1114 demo ADC\r\n");
    
    while(1){
      val = Val;
      pc.printf("Val = %2.1f\r\n", val);
      if (val >= threshold) {
        myled = 1;   // LEDをオンに
      } else {
        myled = 0;   // LEDをオフに
      }
    }
}