SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions about processor boards have here!
User avatar
By tcherpillod
#223235
Hello all - this my first post,

I'm trying to read an analog value from a temperature sensor using a SAM51 MicroMod board. The processor board is installed on an ATP carrier board. The analog signal is connected to the A0 (carrier board pin). The value of the input voltage is a fairly constant 0.571V at room temperature. As a test I have also connected A1 to GND.

I'm using a very simple loop that runs every 10 seconds to read the value at A0 and A1. For reading I'm using the following Arduino command: val = analogRead(A0). val is defined as an int.

I read both A0 and A1 and get the same value for both, The bit count that I read is a little higher than expected (~60mV). What confuses me is the fact that both A0 and A1 come back with the same value.

Am I wrong to us A0 and A1 as the pin descriptor for this board?

Any insight on what I might be doing wrong?

Code:

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

int val;

void loop()
{
val = analogRead(A0);
Serial.print("analog A0 is: ");
Serial.println(val);

delay(200);

val = analogRead(A1);
Serial.print("analog A1 is: ");
Serial.println(val);
delay(5000);
}

Cheers,

Thierry
User avatar
By adam.g
#223561
Hi Thierry,

Looking at the MicroMod board definition, it appears that there's a mistake with the A0 and A1 definitions (https://github.com/sparkfun/Arduino_Boa ... #L126-L153). They are both set to A0.
Code: Select all
static const uint8_t A0   = PIN_A0;
static const uint8_t A1   = PIN_A0;
This would make sense why you're getting the same values on both pins. SparkFun will need to make a change to their board definition to fix this. I created a GitHub issue about this, here: https://github.com/sparkfun/Arduino_Boards/issues/74

Cheers,
Adam
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum