Engine freak out with Mege2560

So I'm building a UAV with an Arduino Mega 2560, Phoenix ICE HV 80 ESC, and a Himax HC5030 brushless motor setup. I've tested the setup previously using an Arduino UNO, and worked fine. Now with the Mega2560, the motor is freaking out. Its armed, it remains at zero throttle, goes to an unknown (kinda high) throttle... the UAV starts tipping and I end up crunching the landing gear in my haste to keep it from doing a barrel roll on my desk. :<

The code is attached, if anyone can take a look and figure it out while I go to the hobby store for new landing gear (before they close), it would be much appreciated... because this is starting to feel over my head.

In case anyone was wondering, the commented out portions are the rest of my setup. I just commented them out to test the pieces before I try to do the whole thing. The engine-1 was the only thing connected to the mega... and the pins were in 5v, Gnd, and A0... the ESC pins were red, brown, and orange respectively.

CtrlEngine.ino (1.09 KB)

UAVHover_1_0ctrltest.ino (793 Bytes)

I suppose the terminal assignments may have changed with the move to the new hardware. Do you have a current wiring diagram?

To start, on the earlier post I meant A1, not A0. Sorry about that. About the wiring diagram, the best I could do is attached. I knew I forgot something today... I forgot to take the props off before I tested the engines again.

Wiring Engine.bmp (820 KB)

Also, I attached servos earlier to the circuit and they worked fine. From the motors going, I'm guessing the motor's power is fine as well. I think the problem is with the signal.

Also, (not too eager to test this) I recall the wing with the engine running going DOWN. Did I put the prop on backward? Do I need to switch power and ground lines between the motor and ESC? Hopefully, I'm just remembering wrong, but just in case.

Is the high throttle being demanded by the Arduino?

Maybe? I don't know anymore if it really did screw up. Maybe the motor did as it was suppose to. I'm the one who forgot to take off the prop... I won't be working on the plane until morning (poor lighting and no heating) so I'll know more in the morning. I really hope that was just me over-reacting to the broken landing gear (kinda) and it was working ok.

I'm sorry if this turns out to have been a waste of you guys time.

Hey guys, I built myself new landing gear (pretty proud of it) and connected everything up... and still doesn't work. I started a new thread since this seems to be a new problem (instead of freaking out, it now does nothing) which is called "Running engines with Mega2560". Thank you to those who read and replied, I hope to hear from you on the new thread too.

-Lee