Simplified version of Henry Herman original code https://os.mbed.com/users/henryeherman/code/MCP3202/docs/tip/mcp3202_8cpp_source.html

include "mcp3202.h"

SPI spi(PA_7,PA_6,PA_5); mosi , miso ,sck

MCP3202 ma_adc = MCP3202(spi, PA_0);

int main() { spi.format(8,0); spi.frequency(1000000); printf("====== Init mcp3202======\n"); ThisThread::sleep_for(1000ms); printf("====== Start ======\n");

while(1)# { printf("Reading of channel A \n"); int valA = ma_adc.readA(); wait_us(1000); printf("Reading of channel B \n"); int valB = ma_adc.readB(); wait_us(1000000); printf ("Result %d , %d \n ", valA , valB); } }

Download repository: zip gz

Files at revision -1:000000000000

Name Size Actions
[up]