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: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
MCP3221 Digital I2C 12bit ADC. 0v - 5v @ 1mV Library.