Servo cannot connect

sorry my english is bad

This example shows how to connect to Cayenne using an ESP8266 and send/receive sample data.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

1. If you have not already installed the ESP8266 Board Package install it using the instructions here:
2. Select your ESP8266 board from the Tools menu.
3. Set the Cayenne authentication info to match the authentication info from the Dashboard.
4. Set the network name and password.
5. Compile and upload the sketch.
6. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.

#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
#include <Servo.h>

// WiFi network info.
char ssid[] = "kopiyen";
char wifiPassword[] = "bebas123";

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "0f3d2bb0-fe1b-11e9-84bb-8f71124cfdfb";
char password[] = "4f7d89bc3da5581de2a04b1f9750da8430591389";
char clientID[] = "0aefc090-0153-11eb-a67f-15e30d90bbf4";

#define ACTUATOR_PIN1 D7

Servo s1;
Servo s2;

void setup() {
  Cayenne.begin(username, password, clientID, ssid, wifiPassword);

void loop() {
  // Determine angle to set the servo.
  int position = getValue.asDouble() * 180;
  // Move the servo to the specified position.
  // Determine angle to set the servo.
  int position = getValue.asDouble() * 180;
  // Move the servo to the specified position.

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
  // Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
  Cayenne.virtualWrite(0, millis());
  // Some examples of other functions you can use to send data.
  //Cayenne.celsiusWrite(1, 22.0);
  //Cayenne.luxWrite(2, 700);
  //Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);

    // Default function for processing actuator commands from the Cayenne Dashboard.
    // You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
      CAYENNE_LOG("Channel %u, value %s",, getValue.asString());
      //Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");

i used this and in data is sending the data but if i sliding on dashboard my servo is cannot rotating.
i use wemos d1 r1 and wemos d1 r2, sorry i cannot show my sketch cause i cannot find wemos d1 r1 or wemos d1 r2 on fritzing.

are you powering the servos from the wemos?

yes why? power is not enough?

yes, you need to power the servo externally, the wemos cant supply the needed power.

like pwm? or from ttl?

the power lines 5v and common ground lines.

if i use this? is enough?

What is the current rating fo this module. And do not connect it to the computer USB, use an power adapter.

rating? rating for what? quality or what?

current rating is the maximum current it can carry or supply.

okey, actually i am from indonesia and now is 9 pm so tomorrow i will try with prefer item

i can give you a workaround. Do you have an old mobile charger? You can cut the wire and use the red and black wire as 5v.

okay thanks for suggestion