Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why the connection breaks when I write the servo motor? #578

Open
DengkeDu opened this issue Nov 20, 2017 · 1 comment
Open

Why the connection breaks when I write the servo motor? #578

DengkeDu opened this issue Nov 20, 2017 · 1 comment

Comments

@DengkeDu
Copy link

DengkeDu commented Nov 20, 2017

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?

@DengkeDu DengkeDu changed the title Why the connection breaks when I write the servo? Why the connection breaks when I write the servo motor? Nov 21, 2017
@Karmageddonium
Copy link

Hi there.. 2022. Have u got a solution? Have the same problem. Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants