Why my servo does't works?

Hi, last day i bought my new servo. It looks ok so i decided to try it, bus when I wrote the code and connect the motor,it doesn't work. the engine did not obey the orders that had been programmed and just spun out of control. Here is the code I used

#include <Servo.h>

Servo myservo;

int potpin = 0;  
int val=90;    

void setup() {
  myservo.attach(9);
}

void loop() {
  myservo.write(val);
  delay(15);
}

Do not use the Arduino 5V output to power servos. Use a separate 5 to 6V power supply capable of providing 1 to 2 Amperes, and don't forget to connect the grounds.

okay,thanks i'll try

Hello seryuf

Check this tutorial to gain the knowledge.

Do NOT follow the tutorial linked above, by @paulpaulson.

It suggests that you can use the Arduino as a servo power supply. You can destroy the Arduino doing so (and the Arduino company sells more Arduinos).

Moderator:
Please don´t cross post thread.
Next time you will be banned.


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