Results 1 to 3 of 3

Thread: In my first post I'm asking for your advice

  1. #1
    Join Date
    Aug 2017
    Location
    Berlin, Germany
    Posts
    3

    Thumbs up In my first post I'm asking for your advice

    Hello everyone,

    Servo won't turn while accepting commands from an Arduino


    I'm attempting to turn a servo with my Arduino when it gets orders from a serial contribution, for this situation, my console. I have officially done this with engines and it works fine however when I attempt with my servo it doesn't move by any means. (an example from - http://www.powerjackmotion.com/produ...o-motor-range/ ) So far I have this written -

    Code:
    #include <SoftwareServo.h>
    
    
    SoftwareServo myservo;
    int movemotor;
    void setup() {  
      Serial.begin(9600);
      myservo.attach (10);
      myservo.write(90);
    }
    void loop() {
      movemotor = Serial.read();
      if (movemotor = 111) {
         for (int pos = 90; pos >=0; pos--) {
           myservo.write(pos);
           delay(15);
        }
      }
      else if (movemotor = 99) {
         for (int pos = 90; pos <= 180; pos++) {
           myservo.write(pos);
           delay(15);
        }
      }
    }
    I'm powering the servo remotely with a 9-volt battery and have made a point to associate its ground to that of the Arduino, however, can't see whatever else I fouled up.


    Any help would be greatly appreciated.
    Thanks

  2. #2
    Join Date
    Jun 2009
    Location
    St. Louis, MO
    Posts
    1,198

    Default

    Disclaimer: I've never done Arduino, but
    After: "delay(15);"
    you need:
    "SoftwareServo::refresh();"
    to actually output anything
    "There are painters who transform the sun into a yellow spot, but there are others who, with the help of their art and their intelligence, transform a yellow spot into the sun." Pablo Picasso

  3. #3
    Join Date
    Aug 2017
    Location
    Berlin, Germany
    Posts
    3

    Default

    Thanks for your reply, no problem at all, maybe someone will help me, I hope so.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •