sho hashimoto
/
cds_led_serial
control LED by CdS http://shokai.org/blog/archives/5103
main.cpp
- Committer:
- shokai
- Date:
- 2010-04-22
- Revision:
- 1:83f0bc743127
- Parent:
- 0:60e8027b95d9
File content as of revision 1:83f0bc743127:
#include "mbed.h" Serial pc(USBTX, USBRX); DigitalOut led1(LED1); // on board LED DigitalOut led2(p11); AnalogIn adc(p15); float ain; int main() { while(1) { led1 = !led1; // blink LED ain = adc; if(ain < 0.4) led2 = 1; else led2 = 0; pc.printf("%f\r\n", (float)ain); wait(0.3); } }