1 (edited by jolue1960 2018-02-19 15:01:04)

Topic: WEMOS D1 Mini - Servo

Hello,
I have the following problem:
I would like to control over the WEMOS D1 mini a Servo by means of Slider. The sketch shows no error and the transfer is also OK. I get the message in the WLAN: "RemoteXY - Not in range". When I load another sketch on the WEMOS (for example turning on the LED with a switch) everything works without problems. The WEMOS is set up as an access point. Can someone help me?
Here's the sketch:

#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
#include <ESP8266WiFi.h>

#include <RemoteXY.h>

// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377


// RemoteXY configurate 
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,1,0,0,0,11,0,8,13,1,
  4,32,24,14,10,77,2,26 };
 
// this structure defines all the variables of your control interface
struct {

    // input variable
  int8_t slider_1; // =-100..100 slider position

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////

#include <Servo.h>

Servo myservo;

void setup()
{
  RemoteXY_Init ();

  myservo.attach(7);
  RemoteXY.slider_1 = 50;
 
  // TODO you setup code
 
}

void loop()
{
  RemoteXY_Handler ();
 
 
  // TODO you loop code
  // use the RemoteXY structure for data transfer

int ms= RemoteXY.slider_1*20*500;
myservo.writeMicroseconds(ms);
}




Thank you for your help and best regards
Joachim

2

Re: WEMOS D1 Mini - Servo

Please, check it sketch without Servo.h
AP mode works as a soft AP using many resources of ESP.
Perhaps it is a resource conflict when the servo library is used.

3

Re: WEMOS D1 Mini - Servo

Hello,
first of all many thanks for the info.
When I remove #include <Servo.h> from the sketch, I get the following error message:

'myservo' was not declared in this scope  myservo.writeMicroseconds (ms).

Is there a solution to the problem?

Thanks and best regards
Joachim

4

Re: WEMOS D1 Mini - Servo

Delete all code which using servo.h

5

Re: WEMOS D1 Mini - Servo

Hello,
Thanks for the feedback.
Since I am still a beginner, I do not know which code belongs to Servo.h.
Can you tell me what I have to delete everything and what code I then
Need to control the servo.
So far, I have always oriented myself to the examples.

Many Thanks
Joachim

6

Re: WEMOS D1 Mini - Servo

Hello everyone,

is there anyone here in the community who can help me with this problem?

Joachim