I've built a quadcopter and the hardware is ready, but I get a strange behaviour: What I've done (Arduino Uno 3):
RC: I wrote a Library to use micros() and ext interrupts aswell as 3 PCInterrupts. Everything coded by me: I didn't use digitalRead() and attachInt. to speed it up. Same with PCInt: I use one int per Port (B,C,D) to avoid the need of finding the source for the int. Sensor: This is a tough one: I use a GY-86 which has a MPU6050. Therefore I use the I2Cdevlib code. This takes the fifth and last pin change interrupt. Motors: I use 4 ESCs and motors. These are fed with the Servo library.
The problem is, that the motors start to wiggle, uncontrolled, spontane and seamingly random. All 4 motors turn down just a little. Then after a very short time they are back at normal. This occurs every second or so and sometimes its 5 seconds in between. The behaviour is like when you set the motors to 0 and back to 1500us shortly afterwards.
Could this have to do with Interrupt clashes? I use 5 Interrupts for rc (4) and sensor (1). What I mean: The interrupts from the rc come in and thereby the motor ones (output) are delayed. Could this make the signal of the servo library to stop somehow? So that 1 sample or a few become 0 or so long, that it's neglected?
If I want a Servo to go 1500 for some time, do I have to call writeServo(1500); on each loop iteration, or does it save the value I gave for the last time and repeats it over until I change it?
Do you have any other ideas, where the strange motor behaviour could come from?