Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- -- New project --
- This source code of graphical user interface
- has been generated automatically by RemoteXY editor.
- To compile this code using RemoteXY library 2.4.3 or later version
- download by link http://remotexy.com/en/library/
- To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
- - for ANDROID 4.3.1 or later version;
- - for iOS 1.3.5 or later version;
- This source code is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- */
- //////////////////////////////////////////////
- // RemoteXY include library //
- //////////////////////////////////////////////
- // RemoteXY select connection mode and include library
- #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,3,0,0,0,43,0,8,13,0,
- 4,0,9,1,8,61,2,26,4,0,
- 80,1,8,61,2,26,129,0,33,8,
- 25,6,17,107,105,101,114,117,110,101,
- 107,0,3,131,33,15,25,9,2,26 };
- // this structure defines all the variables of your control interface
- struct {
- // input variable
- int8_t slider_left; // =0..100 slider position
- int8_t slider_right; // =0..100 slider position
- uint8_t kierunek_1; // =0 if select position A, =1 if position B, =2 if position C, ...
- // other variable
- uint8_t connect_flag; // =1 if wire connected, else =0
- } RemoteXY;
- #pragma pack(pop)
- /////////////////////////////////////////////
- // END RemoteXY include //
- /////////////////////////////////////////////
- int leftSl = 0;
- int rightSl = 0;
- int kierunek;
- void setup()
- {
- RemoteXY_Init ();
- // TODO you setup code
- pinMode(D1, OUTPUT);
- pinMode(D2, OUTPUT);
- pinMode(D5, OUTPUT);
- pinMode(D6, OUTPUT);
- }
- void loop()
- {
- RemoteXY_Handler ();
- kierunek = RemoteXY.kierunek_1;
- leftSl = RemoteXY.slider_left;
- rightSl = RemoteXY.slider_right;
- // TODO you loop code
- // use the RemoteXY structure for data transfer
- if (kierunek==0)
- {
- analogWrite(D1, LOW);
- digitalWrite(D2, LOW);
- analogWrite(D5, LOW);
- digitalWrite(D6, LOW);
- }
- if (kierunek==1)
- {
- analogWrite(D1, leftSl * 10);
- digitalWrite(D2, HIGH);
- analogWrite(D5, rightSl * 10);
- digitalWrite(D6, HIGH);
- }
- if(kierunek==2)
- {
- analogWrite(D2, leftSl * 10);
- digitalWrite(D1, HIGH);
- analogWrite(D6, rightSl * 10);
- digitalWrite(D5, HIGH);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement