1#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
2#include <ESP8266WiFi.h>
3#include<Servo.h>
4#include
5 <RemoteXY.h>
6
7
8#define REMOTEXY_WIFI_SSID
9 "RemoteXY"
10#define REMOTEXY_WIFI_PASSWORD "12345678"
11#define REMOTEXY_SERVER_PORT
12 6377
13
14
15
16#pragma pack(push, 1)
17uint8_t RemoteXY_CONF[]
18 =
19 { 255,1,0,0,0,20,0,13,24,1,
20 2,1,21,26,22,11,2,26,31,31,
21 79,78,0,79,70,70,0
22 };
23
24
25struct {
26
27
28 uint8_t switch_1;
29
30
31 variable
32 uint8_t connect_flag;
33
34} RemoteXY;
35#pragma pack(pop)
36
37
38#define
39 PIN_SWITCH_1 D5
40#define PIN D4
41
42Servo myservo1;
43Servo myservo2;
44
45void
46 setup()
47{
48 RemoteXY_Init ();
49
50 pinMode (PIN_SWITCH_1, OUTPUT);
51
52 pinMode (PIN, OUTPUT);
53
54 myservo1.attach(PIN_SWITCH_1);
55 myservo2.attach(PIN);
56
57
58}
59
60void loop()
61{
62 RemoteXY_Handler ();
63
64 int poz = RemoteXY.switch_1;
65
66
67 if (poz == 1){
68 myservo1.write(30);
69 myservo2.write(30);
70
71
72 }
73 else if (poz == 0){
74 myservo1.write(165);
75 myservo2.write(180);
76
77
78 }
79 else{
80
81 }
82
83
84
85
86}