I2C ADC to SPI DAC example
Dependencies: MCP3221 MCP4822lib mbed
Fork of MCP3221_TEST by
Diff: main.cpp
- Revision:
- 3:c6fa88392c58
- Parent:
- 1:38e8128d989b
--- 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);
