Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:058183080519, committed 2016-10-23
- Comitter:
- chirags
- Date:
- Sun Oct 23 21:12:10 2016 +0000
- Commit message:
- Basic sensor reading
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 058183080519 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Oct 23 21:12:10 2016 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +DigitalOut select0_mux1(p24); +DigitalOut select1_mux1(p23); +DigitalOut select2_mux1(p22); +DigitalOut select3_mux1(p21); +AnalogIn analog_read_1(p20); + +int getBit(int num, int bitNo) { + return ((num&(1<<bitNo)) > 0)?1:0; +} + +int main() { + while(1) { + + for (int i = 0; i< 16; i++) { + printf("Select Line: %d ", i); + + // This code will select the select lines on the mbed + select0_mux1 = getBit(i, 0); + select1_mux1 = getBit(i, 1); + select2_mux1 = getBit(i, 2); + select3_mux1 = getBit(i, 3); + wait(0.01); + printf("Analog Read Value: %f\n ", analog_read_1.read()); + wait(3); + } + } +}
diff -r 000000000000 -r 058183080519 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Oct 23 21:12:10 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file