Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.    -- New project --
  3.    
  4.    This source code of graphical user interface  
  5.    has been generated automatically by RemoteXY editor.
  6.    To compile this code using RemoteXY library 2.3.3 or later version  
  7.    download by link http://remotexy.com/en/library/
  8.    To connect using RemoteXY mobile app by link http://remotexy.com/en/download/                    
  9.      - for ANDROID 4.1.1 or later version;
  10.      - for iOS 1.2.1 or later version;
  11.      
  12.    This source code is free software; you can redistribute it and/or
  13.    modify it under the terms of the GNU Lesser General Public
  14.    License as published by the Free Software Foundation; either
  15.    version 2.1 of the License, or (at your option) any later version.    
  16. */
  17.  
  18. //////////////////////////////////////////////
  19. //        RemoteXY include library          //
  20. //////////////////////////////////////////////
  21.  
  22. // RemoteXY select connection mode and include library  
  23. #define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
  24. #include <ESP8266WiFi.h>
  25.  
  26. #include <RemoteXY.h>
  27.  
  28. // RemoteXY connection settings  
  29. #define REMOTEXY_WIFI_SSID "AirRide"
  30. #define REMOTEXY_WIFI_PASSWORD "12345678"
  31. #define REMOTEXY_SERVER_PORT 80
  32.  
  33.  
  34. // RemoteXY configurate  
  35. #pragma pack(push, 1)
  36. uint8_t RemoteXY_CONF[] =
  37.   { 255,5,0,0,0,68,0,8,13,1,
  38.   1,0,4,30,21,21,2,31,85,112,
  39.   0,1,0,5,64,18,18,2,31,68,
  40.   111,119,110,0,1,0,40,31,20,20,
  41.   2,31,85,112,0,1,0,41,63,19,
  42.   19,2,31,68,111,119,110,0,1,2,
  43.   6,86,53,11,2,31,83,104,111,119,
  44.   77,111,100,101,0 };
  45.    
  46. // this structure defines all the variables of your control interface  
  47. struct {
  48.  
  49.     // input variable
  50.   uint8_t button_1; // =1 if button pressed, else =0
  51.   uint8_t button_2; // =1 if button pressed, else =0
  52.   uint8_t button_3; // =1 if button pressed, else =0
  53.   uint8_t button_4; // =1 if button pressed, else =0
  54.   uint8_t button_5; // =1 if button pressed, else =0
  55.  
  56.     // other variable
  57.   uint8_t connect_flag;  // =1 if wire connected, else =0
  58.  
  59. } RemoteXY;
  60. #pragma pack(pop)
  61.  
  62. /////////////////////////////////////////////
  63. //           END RemoteXY include          //
  64. /////////////////////////////////////////////
  65.  
  66. #define PIN_BUTTON_1 D0
  67. #define PIN_BUTTON_2 D1
  68. #define PIN_BUTTON_3 D2
  69. #define PIN_BUTTON_4 D3
  70. #define PIN_BUTTON_5 D4
  71.  
  72.  
  73. void setup()  
  74. {
  75.   RemoteXY_Init ();  
  76.    
  77.   pinMode (PIN_BUTTON_1, OUTPUT);
  78.   pinMode (PIN_BUTTON_2, OUTPUT);
  79.   pinMode (PIN_BUTTON_3, OUTPUT);
  80.   pinMode (PIN_BUTTON_4, OUTPUT);
  81.   pinMode (PIN_BUTTON_5, OUTPUT);
  82.    
  83.   // TODO you setup code
  84.  
  85. }
  86.  
  87. void loop()  
  88. {  
  89.  
  90.   RemoteXY_Handler ();
  91.    
  92.   digitalWrite(PIN_BUTTON_1, (RemoteXY.button_1==0)?LOW:HIGH);
  93.   digitalWrite(PIN_BUTTON_2, (RemoteXY.button_2==0)?LOW:HIGH);
  94.   digitalWrite(PIN_BUTTON_3, (RemoteXY.button_3==0)?LOW:HIGH);
  95.   digitalWrite(PIN_BUTTON_4, (RemoteXY.button_4==0)?LOW:HIGH);
  96.   digitalWrite(PIN_BUTTON_5, (RemoteXY.button_5==0)?LOW:HIGH);
  97.   if (RemoteXY.button_5==1)
  98.   {
  99.     digitalWrite(PIN_BUTTON_2,HIGH);
  100.     digitalWrite(PIN_BUTTON_4,HIGH);
  101.     delay(2000);
  102.     digitalWrite(PIN_BUTTON_2,LOW);
  103.     digitalWrite(PIN_BUTTON_4,LOW);  
  104.   }
  105.   // TODO you loop code
  106.   // use the RemoteXY structure for data transfer
  107.  
  108.  
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement