David Styles
/
MCP3221_TEST
MCP3221_Test Program.
Revision 0:88f03a5d0ca0, committed 2012-10-31
- Comitter:
- DaveStyles
- Date:
- Wed Oct 31 22:16:00 2012 +0000
- Commit message:
- MCP3221 Test Program
Changed in this revision
diff -r 000000000000 -r 88f03a5d0ca0 MCP3221.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MCP3221.lib Wed Oct 31 22:16:00 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/DaveStyles/code/MCP3221/#db4e3d0374fe
diff -r 000000000000 -r 88f03a5d0ca0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 31 22:16:00 2012 +0000 @@ -0,0 +1,25 @@ + +#include "mbed.h" +#include "MCP3221.h" + +DigitalOut myled(LED1); + +Serial pc(USBTX, USBRX); // tx, rx +AnalogIn ain(p20); +MCP3221 adc(p9, p10, 5.0); //sda, scl, supplyVoltage + +int main() { + + wait(1); + while (1) { + + pc.printf("ain: %f :: ", ain.read()*3.3); + pc.printf("adc: %f \r\n", adc.read()); + + + myled=!myled; + + + wait(1); + } +}
diff -r 000000000000 -r 88f03a5d0ca0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 31 22:16:00 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e \ No newline at end of file