First I thought that my APM2.8 was malfunctioning but then I made following code to test out my module that I have bought on ebay:
/*
ANALOG OUTPUT FOR THE APM2.8
11.12.2016
BY ENGINEER PAVLE DUKANOVIC
www.dukelanovic.com
*/
// These constants won’t change. They’re used to give names
// to the pins used:
const int analogInPin1 = A0; // Analog input pin NEXT TO Telemetry port (PF0) marked with S
const int analogInPin2 = A1; //PF1
const int analogInPin3 = A2; //PF2
const int analogInPin4 = A3; //PF3
const int analogInPin5 = A4; //PF4
const int analogInPin6 = A5; //PF5
const int analogInPin7 = A6; //PF6
const int analogInPin8 = A7; //PF7
const int analogInPin9 = A8; //PK0
const int analogOutPin1 = 12; // ESC1
const int analogOutPin2 = 11; // ESC2
const int analogOutPin3 = 8; // ESC3
const int analogOutPin4 = 7; // ESC4
const int analogOutPin5 = 6; // ESC5
const int analogOutPin6 = 3; // ESC6
const int analogOutPin7 = 2; // ESC7
const int analogOutPin8 = 5; // ESC8
int sensorValue1 = 0; // analog value read
int sensorValue2 = 0; // analog value read
int sensorValue3 = 0; // analog value read
int sensorValue4 = 0; // analog value read
int sensorValue5 = 0; // analog value read
int sensorValue6 = 0; // analog value read
int sensorValue7 = 0; // analog value read
int sensorValue8 = 0; // analog value read
int sensorValue9 = 0; // analog value read
int outputValue = 0; // value output to the PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue1 = analogRead(analogInPin1);
sensorValue2 = analogRead(analogInPin2);
sensorValue3 = analogRead(analogInPin3);
sensorValue4 = analogRead(analogInPin4);
sensorValue5 = analogRead(analogInPin5);
sensorValue6 = analogRead(analogInPin6);
sensorValue7 = analogRead(analogInPin7);
sensorValue8 = analogRead(analogInPin8);
sensorValue9 = analogRead(analogInPin9);
// map it to the range of the analog out:
outputValue = map(1023, 0, 1023, 0, 255);
analogWrite(analogOutPin1, outputValue);
analogWrite(analogOutPin2, outputValue);
analogWrite(analogOutPin3, outputValue);
analogWrite(analogOutPin4, outputValue);
analogWrite(analogOutPin5, outputValue);
analogWrite(analogOutPin6, outputValue);
analogWrite(analogOutPin7, outputValue);
analogWrite(analogOutPin8, outputValue);
delay(1000);
outputValue = map(0, 0, 1023, 0, 255);
analogWrite(analogOutPin1, outputValue);
analogWrite(analogOutPin2, outputValue);
analogWrite(analogOutPin3, outputValue);
analogWrite(analogOutPin4, outputValue);
analogWrite(analogOutPin5, outputValue);
analogWrite(analogOutPin6, outputValue);
analogWrite(analogOutPin7, outputValue);
analogWrite(analogOutPin8, outputValue);
delay(1000);
// change the analog out value:
// print the results to the serial monitor:
Serial.print("sensor1 = ");
Serial.print(sensorValue1);
Serial.print("sensor2 = ");
Serial.print(sensorValue2);
Serial.print("sensor3 = ");
Serial.print(sensorValue3);
Serial.print("sensor4 = ");
Serial.print(sensorValue4);
Serial.print("sensor5 = ");
Serial.print(sensorValue5);
Serial.print("sensor6 = ");
Serial.print(sensorValue6);
Serial.print("sensor7 = ");
Serial.print(sensorValue7);
Serial.print("sensor8 = ");
Serial.print(sensorValue8);
Serial.print("sensor9 = ");
Serial.print(sensorValue9);
//Serial.print("\t output = ");
// Serial.println(outputValue);
// wait 2 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(2);
}
I found out that my hardware was functioning well and there was no malfunction with my software.
I want to keep the things simple and my plan is to program a simple code onto that complex hardware. I would be very happy if someone could help me with that. I discovered that any Arduino environment can program the APM2.8.
Further Thanks to Randy McCain and to the ingenious team about the flightcontroller project. I am a little handicapped and I need to know the basics about programming APM.
For now I found an easy code for programming on the website of Joop Brokking :
http://www.brokking.net/ymfc-al_main.html and my plan is to impement the simple code to the APM2.8 and to build up the flight controller step by step. I need to know how the whole story does function.