I want to control the servo motor's angle through bluetooth connection on android app.
It is ok for control the led on and off:
void switchCharacteristicWritten(BLEDevice central, BLECharacteristic characteristic) {
// central wrote new value to characteristic, update LED
Serial.print("Characteristic event, written: ");
if (switchChar.value()) {
Serial.println("LED on");
digitalWrite(ledPin, HIGH);
} else {
Serial.println("LED off");
digitalWrite(ledPin, LOW);
}
}
But when I control the servo motor, the connection was break, the initial position was 90 angles:
void switchCharacteristicWritten(BLEDevice central, BLECharacteristic characteristic) {
// central wrote new value to characteristic, update LED
Serial.print("Characteristic event, written: ");
if (switchChar.value()) {
Serial.println("LED on");
digitalWrite(ledPin, HIGH);
myservo.write(120);
} else {
Serial.println("LED off");
digitalWrite(ledPin, LOW);
myservo.write(60);
}
}
Why the writing for servo motor breaks the BLE connnection?
I want to control the servo motor's angle through bluetooth connection on android app. It is ok for control the led on and off:
But when I control the servo motor, the connection was break, the initial position was 90 angles:
Why the writing for servo motor breaks the BLE connnection?