Arduino Nano Every and servo motors

Hi everyone!
I'm trying to run a servo motor using an Arduino Nano Every board. Here's the code (I took it from the examples in the library folder):

#include <Servo.h>
Servo rudder;
int angle = 56;

void setup() {
  rudder.attach(2);
}

void loop() {
  rudder.write(angle);
  delay(400);
}

Every time I change the value inside the variable 'angle' and run the code it moves to the same position. It's very weird but the most strange thing is that when few months ago I used an Arduino Mega with the same code it was working perfectly. I changed the pin and double-checked the skematic but no way. I tried also to use the "writeMicroseconds" function instead, but I got the same result. I really don't know which way to turn, so any suggestion wuold be very useful.
Thank you all for your help

If

then why would you expect this

to send the servo to different angles whe ```angle`` remains the same value?

Can You show that code? It's not fullt clear what You try to tell.

As I said I runned the code more than once, every time using a different angle. Like the first time it was:

int angle = 10

and the second

int angle = 20

and so on

I hope that now it's more clear

If you want the servo to start at a certain angle:

int angle = 56;
void setup()
{
  rudder.write(angle);
  rudder.attach(2);
}

does this make the servo move.

#include <Servo.h>
Servo rudder;
int angle = 5;

void setup() {
  rudder.attach(2);
rudder.write(angle);
}

void loop() {
  rudder.write(angle);
angle =  angle+5;

if (angle >= 2500)
{
angle = 0;
rudder.write(5);
}
  delay(60);
}

doe the servo move now?

post an IMAGE of you project.

post a schematic.

Thank you for your help!
I've tried your code, here's a video of what happen after I run it (https://photos.app.goo.gl/1N2zzJ6CRosWcAsY7).
schematic:

VCC 5V
GND GND
pulse 2D

sorry for the pronunciation in the video- I'm not a native.

the code on your screen in the video is not the code from post#7. The code you ran made the servo move to one position and stay there. The code you ran worked as you wrote.

Could you try the code from post#7?

I have shown you 3 different codes in the video, the first one was the code from post #7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.