# Servo won't turn while accepting commands from an Arduino

**URL:** <https://community.sparkfun.com/t/servo-wont-turn-while-accepting-commands-from-an-arduino/34759>\
**Category:** Arduino\
**Created:** [August 30, 2017, 5:54pm UTC](https://community.sparkfun.com/t/servo-wont-turn-while-accepting-commands-from-an-arduino/34759 "2017-08-30T17:54:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jessus81](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Jessus81](https://community.sparkfun.com/u/Jessus81)\
**Post date:** [August 30, 2017, 5:54pm UTC](https://community.sparkfun.com/t/servo-wont-turn-while-accepting-commands-from-an-arduino/34759/1 "2017-08-30T17:54:38Z")

</div>

Hi,

In my first post, I’m asking for your advice, please -

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/product- … tor-range/](http://www.powerjackmotion.com/product-category/electric-motor/servo-motor-range/) ) So far I have this written -

```auto
#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.

Your advice/help would be highly appreciated.

Many Thanks

---

<div class="post-metadata">

**Author:** ![Valen](https://avatars.discourse-cdn.com/v4/letter/v/9dc877/32.png) [@Valen](https://community.sparkfun.com/u/Valen)\
**Post date:** [September 7, 2017, 10:54am UTC](https://community.sparkfun.com/t/servo-wont-turn-while-accepting-commands-from-an-arduino/34759/2 "2017-09-07T10:54:15Z")

</div>

Do you send 3 individual ‘1’ characters? Or do you send the character ‘o’ (lowercase ‘oh’) or ‘Z’? Try and see which one makes it turn?

---

<div class="post-metadata">

**Author:** ![Valen](https://avatars.discourse-cdn.com/v4/letter/v/9dc877/32.png) [@Valen](https://community.sparkfun.com/u/Valen)\
**Post date:** [September 7, 2017, 11:15am UTC](https://community.sparkfun.com/t/servo-wont-turn-while-accepting-commands-from-an-arduino/34759/3 "2017-09-07T11:15:04Z")

</div>

Also, while debugging it is sensible to send back what is actually received to check for communication corruption. (as motors can create a lot of electrical noise when they engage/disengage) So add Serial.println(movemotor); before the if-statement.
