![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
YIC day 3
main.cpp
- Committer:
- lingtien5846
- Date:
- 2015-04-02
- Revision:
- 0:670f0c52502f
File content as of revision 0:670f0c52502f:
#include "mbed.h" AnalogIn sound(p20); DigitalOut led1(LED1); int main() { float number = 0.0; led1 = 0; number = sound; while(1){ if (0 <= number < 0.25) { led1 = 1; } else if (0.25 <= number < 0.5) { led1 = 0; } else if (0.5 <= number < 0.75) { led1 = 1; } else if (0.75 <= number < 1) { led1 = 0; } } }