Jump to content
  • 0

Problems with analog.read using ANALOG SHIELD


trungmanhhuynh

Question

Question 1:
 
I changed a little bit to print out the value on passthrough code: 
 
#include <analogShield.h>   //Include to use analog shield.
#include <SPI.h> //required for ChipKIT but does not affect Arduino
 
void setup()
{
  //no setup
  
  Serial.begin(9600); 
}
 
unsigned int count = 0;
void loop()
{
  count = analog.read(1);  //read in on port labeled 'IN0'
  Serial.println(count);
  analog.write(0, count);  //write out the value on port labeled 'OUT0'
}
 
I read values for all ADC pins 0->3. And I see that A0,A2,A3 read correct values with 32,000 for 0V, But for A1, this value is around  2200. 
 
Could you help me explain why that happens? Is that the Shield damaged ?
 
Question 2:
 
Is the default value around 45k, if I dont read anything ? 
 
COuld you help me answer ASAP ? Thank you 
 
 
 
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

1. Have you downloaded the latest version of the library here?

 

https://github.com/mwingerson/analogShield

 

2. To determine if A1 is damaged, run this:

 

#include <analogShield.h>   //Include to use analog shield.
#include <SPI.h> //required for ChipKIT but does not affect Arduino
 
void setup()
{
  //no setup
  
  Serial.begin(9600); 
}
 
unsigned int count = 0;
void loop()
{
  count = analog.read(0);  //read in on port labeled 'IN0'
  Serial.print(count);
  Serial.print("    ");
  count = analog.read(1);  //read in on port labeled 'IN0'
  Serial.print(count);
  Serial.print("    ");
  count = analog.read(2);  //read in on port labeled 'IN0'
  Serial.print(count);
  Serial.print("    ");
  count = analog.read(3);  //read in on port labeled 'IN0'
  Serial.println(count);
}
 
Please take a screenshot of the serial output.
 
3. You probably only want to use analog.signedRead(0)  without "true".  
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...