user82132: I want to use Bluetooth to control my continuous servo motor to rotate 360° once, and I used MIT app inventor for the UI to control it.
My continuous servo motor won't stop rotating even though I tried myservo.write(90).
I was wondering if anything is wrong with my hardware, or whether the problem is in my code as I am a beginner at coding and I put different functions together that I found on the internet (I was trying to make the MIT to send letters to the Arduino code where the letter would activate a command to the servo).
Here's my code:
#include <SoftwareSerial.h> // TX RX software library for bluetooth

#include <Servo.h> // servo library 
Servo myservo; // servo name

int bluetoothTx = 10; // bluetooth tx to 10 pin
int bluetoothRx = 11; // bluetooth rx to 11 pin

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup() {
  myservo.attach(9); // attach servo signal wire to pin 9
  // Setup usb serial connection to computer
  Serial.begin(9600);
  myservo.write(90);  // set servo to mid-point

  // Setup Bluetooth serial connection to android
  bluetooth.begin(9600);
}

void loop() {
  // Read from bluetooth and write to usb serial
  if (bluetooth.available() > 0 ) { // receive number from bluetooth
    int servopos = bluetooth.read(); // save the received number to servopos
    Serial.println(servopos); // serial print servopos current number received from bluetooth

    char c = Serial.read();
    if (c == 'a') {
      myservo.write(180);
      delay(1000);
      myservo.write(90);
    }
    else if (c == 'b') {
      myservo.write(90);
    }
  }
}



Would be really great if you could help

user20245: A "continuous servo" is one in which it stops rotating when the angle is set to 90 degrees, rotates forward when the angle is more than 90 degrees and rotates in reverse when the angle is less than 90 degrees.  The further from the angle of 90 degrees, the faster the continuous servo will rotate.
You can not control the angle of a continuous servo.  There is no feed back to know when it has rotated, say, 360 degrees.
You can only guess at the timing and send a command like "go to angle 100" to start rotating a continuous servo slowly forward then send a command like "go to to angle 90" to stop it after your "guessed at" time of how log it took to travel, say, a quarter the way around has elapsed.
Here is a similar Stack Exchange question where continuous servos are discussed as well.

82132: <p>I want to use Bluetooth to control my continuous servo motor to rotate 360° once, and I used MIT app inventor for the UI to control it.</p>
<p>My continuous servo motor won't stop rotating even though I tried <code>myservo.write(90)</code>.</p>
<p>I was wondering if anything is wrong with my hardware, or whether the problem is in my code as I am a beginner at coding and I put different functions together that I found on the internet (I was trying to make the MIT to send letters to the Arduino code where the letter would activate a command to the servo).</p>
<p>Here's my code:</p>
<pre><code>#include &lt;SoftwareSerial.h&gt; // TX RX software library for bluetooth

#include &lt;Servo.h&gt; // servo library 
Servo myservo; // servo name

int bluetoothTx = 10; // bluetooth tx to 10 pin
int bluetoothRx = 11; // bluetooth rx to 11 pin

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup() {
  myservo.attach(9); // attach servo signal wire to pin 9
  // Setup usb serial connection to computer
  Serial.begin(9600);
  myservo.write(90);  // set servo to mid-point

  // Setup Bluetooth serial connection to android
  bluetooth.begin(9600);
}

void loop() {
  // Read from bluetooth and write to usb serial
  if (bluetooth.available() &gt; 0 ) { // receive number from bluetooth
    int servopos = bluetooth.read(); // save the received number to servopos
    Serial.println(servopos); // serial print servopos current number received from bluetooth

    char c = Serial.read();
    if (c == 'a') {
      myservo.write(180);
      delay(1000);
      myservo.write(90);
    }
    else if (c == 'b') {
      myservo.write(90);
    }
  }
}
</code></pre>
<p><a href="https://i.stack.imgur.com/xekK6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xekK6.jpg" alt="Here's how i set my arduino board" /></a></p>
<p><a href="https://i.stack.imgur.com/AZKU1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AZKU1.png" alt="And the MIT App inventor code" /></a></p>
<p>Would be really great if you could help</p>
 20245: <p>A &quot;<a href="https://en.wikipedia.org/wiki/Servo_(radio_control)#Continuous-rotation_servos" rel="nofollow noreferrer">continuous servo</a>&quot; is one in which it stops rotating when the angle is set to 90 degrees, rotates forward when the angle is more than 90 degrees and rotates in reverse when the angle is less than 90 degrees.  The further from the angle of 90 degrees, the faster the continuous servo will rotate.</p>
<p>You can not control the angle of a continuous servo.  There is no feed back to know when it has rotated, say, 360 degrees.</p>
<p>You can only guess at the timing and send a command like &quot;go to angle 100&quot; to start rotating a continuous servo slowly forward then send a command like &quot;go to to angle 90&quot; to stop it after your &quot;guessed at&quot; time of how log it took to travel, say, a quarter the way around has elapsed.</p>
<p><a href="https://arduino.stackexchange.com/questions/1321/servo-wont-stop-rotating">Here is a similar Stack Exchange question</a> where continuous servos are discussed as well.</p>
