lol
Dependencies: mbed
Revision 0:173bff4974d8, committed 2017-10-27
- Comitter:
- toiy01344
- Date:
- Fri Oct 27 12:11:40 2017 +0000
- Commit message:
- 2.1
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 173bff4974d8 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 27 12:11:40 2017 +0000 @@ -0,0 +1,58 @@ +#include "mbed.h" + +BusOut myleds(D2,D3,D4,D5,D6,D7,D8,D9); + +AnalogIn analog(A0); + + + +int main() { + //lab2.1 + float means; + while(1) { + means = analog.read(); + means = means * 80; + + if(means == 0) + { + myleds = 0 + } + else if (means < 10) + { + myleds = 1; + } + else if (means < 20) + { + myleds = 3; + } + else if (means < 30) + { + myleds = 7; + } + else if (means < 40) + { + myleds = 15; + } + else if (means < 50) + { + myleds = 31; + } + else if (means < 60) + { + myleds = 63; + } + else if (means < 70) + { + myleds = 127; + } + else if (means <= 80) + { + myleds = 255; + } + else + { + myleds = 0; + } + } + } + \ No newline at end of file
diff -r 000000000000 -r 173bff4974d8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 27 12:11:40 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b484a57bc302 \ No newline at end of file