Servo problems

https://zapodaj.net/0bf6c52aa81f3.jpg.html
It’s the first time i’m using a servo motor and this motor is new

Here’s the code:

#include<Servo.h>

Servo servo1;
int i=0;

void setup() {
  // put your setup code here, to run once:
  servo1.attach(6);
  
}

void loop() {
  for(i=0; i<=180; i++){
    servo1.write(i);
    delay(10);
  }
  for(i=180; i<=0; i--){
    servo1.write(i);
    delay(10);
  }
}

I wanted it to go from 0 degrees to 180, then back to 0, and so on.
The servo moves to 180 and then stops. What could be the reason for that?

Look at the second for loop. Do you really want to test that 180 <=0?

Steve

oh. you're right, thanks alot. :)

still though, it doesn't work :(

It sounds like you changed the code. Can you post your latest copy?

sirKrzysztaq:
it doesn’t work

Bummer. But can you be more descriptive? If your expected behavior is still the same, say so.
Then describe the actual behavior.

And maybe include a wiring diagram. Pencil, paper and a camera are good enough if you use proper detail, like pin numbers.
Of particular interest is how you are powering the servo.