Vjekoslav Srb
/
Lab1Vjezba4-2
SRB
Revision 0:8085f6c1ba0a, committed 2015-12-03
- Comitter:
- vjekoslavsrb
- Date:
- Thu Dec 03 17:55:04 2015 +0000
- Commit message:
- Radi Lab1vjezba4-2 VU METER
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 8085f6c1ba0a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 03 17:55:04 2015 +0000 @@ -0,0 +1,46 @@ + #include "mbed.h" + Serial pc(USBTX, USBRX); + AnalogIn Ain(p20); + DigitalOut myled1(LED1); + DigitalOut myled2(LED2); + DigitalOut myled3(LED3); + DigitalOut myled4(LED4); + float x; + + int main() { + + while (1) { + x=Ain; + wait (0.5); + if (x<=0.2){ + myled1=0; + myled2=0; + myled3=0; + myled4=0; + } + if (x>0.2&x<=0.4){ + myled1=1; + myled2=0; + myled3=0; + myled4=0; + } + if (x>0.4&x<=0.6){ + myled1=1; + myled2=1; + myled3=0; + myled4=0; + } + if (x>0.6&x<=0.8){ + myled1=1; + myled2=1; + myled3=1; + myled4=0; + } + if (x>0.8&x<=1.0){ + myled1=1; + myled2=1; + myled3=1; + myled4=1; + } + } + }
diff -r 000000000000 -r 8085f6c1ba0a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 03 17:55:04 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b \ No newline at end of file