Skip to content
Arthur Benemann edited this page Mar 15, 2013 · 1 revision

!ArduPilotMega has two spare ports for additional analog sensors. You can find them on the IMU shield here.

http://ardupilot-mega.googlecode.com/svn/ArduPilotMegaImages/expansion.png

The data can be read on Arduino's Analog 6 and Analog7. Here's a sample sketch that will show you how:

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

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

void loop()
{
  val1 = analogRead(6);    // read the input pin
  Serial.print("Analog 6: ");
  Serial.print(val1);             // debug value
  val2 = analogRead(7);    // read the input pin
  Serial.print("  Analog 7: ");
  Serial.println(val2);             // debug value

}
Clone this wiki locally