• 0
trungmanhhuynh

Problems with analog.read using ANALOG SHIELD

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 
 
 
 
Edited by Josh
Added Tags

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

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".  

Share this post


Link to post
Share on other sites
  • 0
On 4/1/2015 at 5:51 PM, mwingerson said:

3. You probably only want to use analog.signedRead(0)  without "true".  

Why would that be? Is the differential read just slow, or is there a bug?

Share this post


Link to post
Share on other sites
  • 0

No, the differential read is fine.  Just I wouldn't use it unless I was meaning to use it.  I suspected trungmanhhuynh wasn't using the differential mode.

Hope this clears it up.

Marshall

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now