Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Pin 9 and 14 linked should be be connected to ground.  VREF (15) and VDD should be connected to your VCC(3.3v)

Sample Code


Code Block
#include <MCP3008.h>

// define pin connections
#define CS_PIN 12
#define CLOCK_PIN 9
#define MOSI_PIN 11
#define MISO_PIN 10


MCP3008 adc(CLOCK_PIN, MOSI_PIN, MISO_PIN, CS_PIN);

void setup() {
 Serial.begin(9600);
}


void loop() {
  int val = adc.readADC(0); // read Chanel 0 from MCP3008 ADC
  Serial.println(val);
}



Libraries

LibraryURL
MCP3008 by Uros Petrevskihttps://github.com/nodesign/MCP3008
MCP3008 by Adafruithttps://github.com/adafruit/Adafruit_MCP3008

...