![](/media/cache/profiles/9fdb62f932adf55af2c0e09e55861964.50x50_q85.jpg)
control LED by CdS http://shokai.org/blog/archives/5103
main.cpp
- Committer:
- shokai
- Date:
- 2010-04-21
- Revision:
- 0:60e8027b95d9
- Child:
- 1:83f0bc743127
File content as of revision 0:60e8027b95d9:
#include "mbed.h" Serial pc(USBTX, USBRX); // tx, rx DigitalOut led1(LED1); DigitalOut led2(p11); AnalogIn adc(p15); int ain; int main() { while(1) { if(led1){ led1 = 0; } else{ led1 = 1; } ain = adc; if(adc < 0.4){ led2 = 1; } else{ led2 = 0; } pc.printf("%f", (double)adc); pc.printf("\r\n"); wait(0.3); } }