Simon Ford
/
AnalogIn_test
Revision 0:74646ad55e99, committed 2009-10-10
- Comitter:
- simon
- Date:
- Sat Oct 10 22:14:46 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 74646ad55e99 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Oct 10 22:14:46 2009 +0000 @@ -0,0 +1,22 @@ +// 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]); + } + } +} \ No newline at end of file
diff -r 000000000000 -r 74646ad55e99 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Oct 10 22:14:46 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a0336ede94ce