The servos control works fine. I manage to control the servo with serial commands.
I though the problem came from interrupts. I also use ADC interrupt in my software buy I tried without and I have the same problem.
I tried with your test sketch for ServoDecoder and ServoTimer2 and this is the problem:
The decoder is in Failsafe
Cx0= 10819 Cx1= 1099 Cx2= 1497 Cx3= 1482 Cx4= 1497 Cx5= 1482 Cx6= 1489 Cx7= 1493 Cx8= 1087
The decoder is in Failsafe
Cx0= 10824 Cx1= 1099 Cx2= 1497 Cx3= 1482 Cx4= 1497 Cx5= 1482 Cx6= 1489 Cx7= 1493 Cx8= 1086
The decoder is in Failsafe
Cx0= 10822 Cx1= 1099 Cx2= 1497 Cx3= 1482 Cx4= 1497 Cx5= 1482 Cx6= 1497 Cx7= 1491 Cx8= 1081
Ch1= 1100 Ch2= 1489 Ch3= 1493 Ch4= 1484 Ch5= 1487 Ch6= 1493 Ch7= 1489 Ch8= 1094
The decoder is in Failsafe
Cx0= 10820 Cx1= 1099 Cx2= 1497 Cx3= 1482 Cx4= 1496 Cx5= 1488 Cx6= 1490 Cx7= 1491 Cx8= 1084
The decoder is in Failsafe
Without attaching a servo it works fine.
I used the Ardu IMU 2+ board.
Edit : I tried with this sketch
// ServoDecodeTest
#include <ServoTimer2.h>
#include <ServoDecode.h>
// define the servo pins
#define servoApin 9 // the pin the servo is attached to/
ServoTimer2 servoA; // declare variables for the servos
char * stateStrings[] = {
"NOT_SYNCHED", "ACQUIRING", "READY", "in Failsafe"};
int count;
void setup() // run once, when the sketch starts
{
Serial.begin(38400);
count=0;
// digitalWrite(8, HIGH); // turn on pullup resistor on pin 8
servoA.attach(servoApin);
pinMode(5,OUTPUT); // Red
ServoDecode.begin();
delay(1000);
ServoDecode.setFailsafe();
}
void loop() // run over and over again
{
int pulsewidth;
// print the decoder state
if( ServoDecode.getState()!= READY_state) {
Serial.print("The decoder is ");
Serial.println(stateStrings[ServoDecode.getState()]);
for ( int i =0; i <=MAX_CHANNELS; i++ ){ // print the status of the first four channels
Serial.print("Cx");
Serial.print(i);
Serial.print("= ");
pulsewidth = ServoDecode.GetChannelPulseWidth(i);
Serial.print(pulsewidth);
Serial.print(" ");
digitalWrite(5,HIGH); // Light on Red led
}
Serial.println("");
}
else {
if( count % 20 == 0){ // decoder is ready, print the channel pulse widths every second
for ( int i =1; i <=MAX_CHANNELS; i++ ){ // print the status of the first four channels
Serial.print("Ch");
Serial.print(i);
Serial.print("= ");
pulsewidth = ServoDecode.GetChannelPulseWidth(i);
Serial.print(pulsewidth);
Serial.print(" ");
digitalWrite(5,LOW); // Light off Red led
}
Serial.println("");
}
count++;
}
servoA.write(ServoDecode.GetChannelPulseWidth(3));
delay(20); // update 50 times a second
}
And the LDE is always blinking. (I cannot have the telemetry because I powered the board with the ESC)