I2C ADC to SPI DAC example
Dependencies: MCP3221 MCP4822lib mbed
Fork of MCP3221_TEST by
Revision 3:c6fa88392c58, committed 2015-03-26
- Comitter:
- janekm
- Date:
- Thu Mar 26 14:11:10 2015 +0000
- Parent:
- 2:b28c99e359f6
- Commit message:
- fixed pin assignments
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b28c99e359f6 -r c6fa88392c58 main.cpp --- a/main.cpp Thu Mar 26 13:57:17 2015 +0000 +++ b/main.cpp Thu Mar 26 14:11:10 2015 +0000 @@ -6,15 +6,14 @@ DigitalOut myled(LED1); Serial pc(USBTX, USBRX); // tx, rx -MCP3221 adc(p9, p10, 5.0); //sda, scl, supplyVoltage -MCP4822 dac (p11, p12, p13, p14); +MCP3221 adc(PB_9, PB_8, 5.0); //sda, scl, supplyVoltage +MCP4822 dac (PB_5, PB_3, PA_4, PB_2); // MOSI, SCK, CS, Latch int main() { float reading; wait(1); while (1) { - pc.printf("ain: %f :: ", ain.read()*3.3); reading = adc.read(); pc.printf("adc: %f \r\n", reading); dac.setA(reading);