![](/media/cache/profiles/7c792a8279211dece3b4df04719c818a.50x50_q85.jpg)
ADC TEST CODE of LPC1114FN28
Diff: main.cpp
- Revision:
- 0:87a098bea248
diff -r 000000000000 -r 87a098bea248 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 14 00:49:19 2013 +0000 @@ -0,0 +1,24 @@ +#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をオフに + } + } +} + +