Can not get Servo to work with Nano

Hello to all. I am looking for a little guidance as I am new to Arduino and Programming.

I am using the Arduino Nano for this project and no matter what i do i can not get the servo’s to move

Door Servo PIN 9 PWM
Finger Servo PIN 10 PWM
Switch Input PIN 2 PWM

So 2 questions Is the CODE OK and Am I connecting to the correct points on the NANO Board?

I have written the attached code for a “Useless Box”.
I have also borrowed some code from other builders of the “Useless Box” So thank you to them for posting their code.

I thought this project was going to be easy :confused:

Useless_Box.ino (12.3 KB)

how are your servo powered ? can you describe the wiring? (picture)

have you tried with a super simple code to move them somewhere / sweep ? there is no point trying to debug your big program if that does not work

You've missed out some vital information. What servos are you using and how are the servos powered. Most trouble with servos ends up being power related. Have you tested the servos with the Sweep example program? Do they work with that?

BTW your switch is on pin 3 not pin 2. How is the switch wired? Do you have a pull down resistor? A complete circuit diagram would be useful.

    if (selectedMove > 2) { 
    selectedMove = 0; 
    } //when all moves are played, repeat the moves from beginning

Given this how do you ever expect to get to selectedMove 3,4,5,6,7,8 and 9?

Steve

Hi Thanks for the fast response guys, I haven’t had a chance of yet to try the adjusted code but as soon as i do i will let you know how it goes.

Attached is a wiring drawing of the circuit.

Thank you again.

Useless Box.pdf (120 KB)