Arduino Project Hub

Toolbox 3


Replicated projects 1

5vCircuitPowerMeter

Project tutorial by MicroBob

  • 1,184 views
  • 2 comments
  • 5 respects

Home Automation Control Panel

Project in progress by Jay

  • 16,178 views
  • 9 comments
  • 67 respects

  • Servo about 1 month ago

    Hello katkatkattkac,

    There could be a couple of issues, If you're using more than 5v. , or if it's just cheaply made. Also remember this only works with a 9g servo.

    Sorry it took so long to reply,
    Grant

  • Servo 7 months ago

    The servo used in this tutorial (9g) only rotates 180 degrees, but assuming you have a 360° motor and they work the same this code should help:

    "
    #include <Servo.h>

    Servo x;
    Servo y;

    void setup (){
    x.attach(9); //change 9 to whatever pin your x servo is connected to
    y.attach(6); //change 6 to whatever pin your y servo is connected to
    }

    void loop(){
    while(x < 180){
    x.write(x+10);
    y.write(y+180);
    }
    }
    "

    hope this helps!

  • Servo 7 months ago

    Hello! I have the code set so the servo goes to 90° "s1.write(90);" then stops.

    if you want to:
    1. make the motor sweep back and forth you can set it to go to 178 and then 2 (it's best to give servos a couple degrees of freedom) by following this code:

    "
    #include <Servo.h>

    Servo s1;

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

    void loop(){
    s1.write(178);
    s1.write(2);
    }
    "

    1. make the motor go to 90 and stay there even if you try to move it, follow this code:

    "
    #include <Servo.h>

    Servo s1;

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

    void loop(){
    s1.write(90);
    }
    "

    Hope this helps!

Add projectSign up / Login