ADC

Testing the ADC

Description

Reads the values from the 8 channels and displays them on the serial monitor

Code

(:source:)

  1. include "SPIADCdev.h"
  2. include "SPI.h"

void setup() {

Serial.begin(9600); Analog.begin(1,2,3,4); // SCK , MOSI ,MISO , Chip select }

void loop() {

 for ( int i = 0; i < 8; i++)

{ Serial.print("Reading :" ); Serial.print(i); Serial.print(":"); Serial.print(Analog.Read(i,MODE_12BIT)); // 12 bit mode or 8BIT_MODE delay(50); } }

(:sourceend:)

  

Share |