Sverre Didrichsen
/
Oving5-3A
Revision 0:78d9e6f47c28, committed 2017-09-26
- Comitter:
- mdidrich
- Date:
- Tue Sep 26 12:10:36 2017 +0000
- Commit message:
- Martin
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 78d9e6f47c28 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 26 12:10:36 2017 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" +BusOut bargraph(p21, p22, p23, p24, p25, p26); +AnalogIn ai(p20); + +float map(float x, float x1, float x2, float y1, float y2); + +int main() +{ + while (1) + { + bargraph = (int) map(ai, 0.0, 1.0, 0.0, 33.0); + wait(0.1); + } +} + + +float map(float x, float x1, float x2, float y1, float y2){ + + float y; + y = ( y1 + (x - x1)*((y2-y1)/(x2-x1))); + return y; + } \ No newline at end of file
diff -r 000000000000 -r 78d9e6f47c28 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 26 12:10:36 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/675da3299148 \ No newline at end of file