If the motor is not spinning the most likely cause is that the motor is not making proper contact.
Here is a list of steps from our CoDrone FAQ document that you can try:
-Hold the CoDrone in your hand while giving the drone throttle.
-Wobble the CoDrone motor that will not move. If it spins then the motor works but the frame cannot hold it well. This is common in drones that have crashed often. You can check how many times you have crashed in the Petrone App (iOS or Android)
-If the motor is still not moving, remove the motor. Be careful to do this gently. Repeated, forceful removal of motors may have caused the damaged motor.
-Lift the motor wires so that they can touch the contacts more easily. This video goes over that process.
-Reinsert the motor and repeat step 1.
-If your motor is still not moving then swap the motor with another one on your CoDrone. Sometimes one arm will hold a better fit for a particular motor. Make sure to switch the propellers, too!
-If the motor continues to have issues or fall out, the CoDrone may have had a severe crash that bent the arm. Gently bend the circuit arm back into place.
-Purchase new motors
Hi there @johnnytechknow! You're currently on the phone with @arnold_robolink, but I wanted to link you to the lesson that includes a killswitch in the loop() function. But as he said, when the drone goes up to the ceiling, what's happening is a suction force that keeps it stuck on the ceiling. Throttling down won't be strong enough to make it descend in this case, so having a killswitch is always key. You'll need to put the killswitch in the loop() function of your Arduino code, so that it's constantly checking for input.