Rob Dobson
/
AnalogInExample
Revision 0:f7c1b30aa1cd, committed 2009-11-02
- Comitter:
- Bobty
- Date:
- Mon Nov 02 13:10:45 2009 +0000
- Commit message:
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 f7c1b30aa1cd main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Nov 02 13:10:45 2009 +0000 @@ -0,0 +1,21 @@ +// AnalogIn reading 16-bit samples + +#include "mbed.h" + +AnalogIn input(p20); +DigitalOut led1(LED1); + +int main() { + unsigned short samples[1024]; + + for(int i=0; i<1024; i++) { + samples[i] = input.read_u16(); + wait_ms(1); + } + + printf("Results:\n"); + for(int i=0; i<1024; i++) { + if (samples[i] > 0x100) + printf("%d, 0x%04X\n", i, samples[i]); + } +}
diff -r 000000000000 -r f7c1b30aa1cd mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Nov 02 13:10:45 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a0336ede94ce