I2C ADC to SPI DAC example

Dependencies:   MCP3221 MCP4822lib mbed

Fork of MCP3221_TEST by David Styles

main.cpp

Committer:
DaveStyles
Date:
2012-10-31
Revision:
0:88f03a5d0ca0
Child:
1:38e8128d989b

File content as of revision 0:88f03a5d0ca0:


#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);
    }
}