flok
Active member
Hi,
I'm trying something very simple: reading samples from an MCP3202.
I can't get it to work.
#include <SPI.h>
#include <Mcp320x.h>
#define SPI_CS 10 // SPI slave select
#define ADC_VREF 3300 // 3.3V Vref
#define ADC_CLK 1600000 // SPI clock 1.6MHz
MCP3202 adc(ADC_VREF, SPI_CS);
void setup() {
Serial.begin(115200);
pinMode(SPI_CS, OUTPUT);
digitalWrite(SPI_CS, HIGH);
SPISettings settings(ADC_CLK, MSBFIRST, SPI_MODE0);
SPI.begin();
SPI.beginTransaction(settings);
}
void loop() {
Serial.println(adc.read(MCP3202::Channel::SINGLE_0));
}
I triple checked the wiring of course but I get no output at all.
I'm using this library: https://github.com/labfruits/mcp320x but an other doesn't work either.
Connecting the same ADC to an arduino nano works fine.
I'm trying something very simple: reading samples from an MCP3202.
I can't get it to work.
#include <SPI.h>
#include <Mcp320x.h>
#define SPI_CS 10 // SPI slave select
#define ADC_VREF 3300 // 3.3V Vref
#define ADC_CLK 1600000 // SPI clock 1.6MHz
MCP3202 adc(ADC_VREF, SPI_CS);
void setup() {
Serial.begin(115200);
pinMode(SPI_CS, OUTPUT);
digitalWrite(SPI_CS, HIGH);
SPISettings settings(ADC_CLK, MSBFIRST, SPI_MODE0);
SPI.begin();
SPI.beginTransaction(settings);
}
void loop() {
Serial.println(adc.read(MCP3202::Channel::SINGLE_0));
}
I triple checked the wiring of course but I get no output at all.
I'm using this library: https://github.com/labfruits/mcp320x but an other doesn't work either.
Connecting the same ADC to an arduino nano works fine.