According to the DIYdrone website, APM 2.0 should have 12 analog pins. However, when I tested it out, only A0~A8 which corresponds to 54~62 work as analog pins, but the rest 3 pins do not work. I tested this with an airspeed sensor. The following code is what I used for tests. Does anyone know what I am doing wrong?

-------------------------------------------------------------------------------------------------------------------------------------------------

int val1 = 0; // variables to store the value read

void setup()
{
Serial.begin(38400); // setup serial
}

void loop()
{
val1 = analogRead(63); // read the input pin (it varies from pin 54 to 65)
Serial.print("Analog 63: ");
Serial.print(val1); // debug value
Serial.print("\n");
}

Views: 735

Reply to This

Replies to This Discussion

Never mind. Problem solved.

Could you tell us what was wrong, richie

You need to solder as shown in Fig1. That's it.

Attachments:

are you able to read the pins using "analogIn" class ?

I having problems doing it

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service