Components and supplies
Android device
Resistor 330 ohm
Jumper wires (generic)
Solderless Breadboard Full Size
Lamp (LED)
5 mm LED: Green
Arduino UNO
LED, Blue Green
5 mm LED: Red
ESP8266 ESP-01
Apps and platforms
RemoteXY
Arduino IDE
Project description
Code
Code
c_cpp
1//www.YouTube.com/Electronics is Fun// 2 3*/ 4 5////////////////////////////////////////////// 6// RemoteXY include library // 7////////////////////////////////////////////// 8 9// RemoteXY select connection mode and include library 10#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT 11 12#include <RemoteXY.h> 13 14// RemoteXY connection settings 15#define REMOTEXY_SERIAL Serial 16#define REMOTEXY_SERIAL_SPEED 115200 17#define REMOTEXY_WIFI_SSID "RemoteXY" 18#define REMOTEXY_WIFI_PASSWORD "********" 19#define REMOTEXY_SERVER_PORT 6377 20 21 22// RemoteXY configurate 23#pragma pack(push, 1) 24uint8_t RemoteXY_CONF[] = 25 { 255,4,0,0,0,64,0,8,165,0, 26 2,0,6,8,22,11,36,26,31,31, 27 79,78,0,79,70,70,0,2,0,62, 28 9,22,11,134,26,31,31,79,78,0, 29 79,70,70,0,2,0,8,38,22,11, 30 203,26,31,31,79,78,0,79,70,70, 31 0,1,0,67,37,12,12,31,31,88, 32 0 }; 33 34// this structure defines all the variables of your control interface 35struct { 36 37 // input variable 38 uint8_t RED_LED; // =1 if switch ON and =0 if OFF 39 uint8_t GREEN_LED; // =1 if switch ON and =0 if OFF 40 uint8_t BLUE_LED; // =1 if switch ON and =0 if OFF 41 uint8_t LAMP; // =1 if button pressed, else =0 42 43 // other variable 44 uint8_t connect_flag; // =1 if wire connected, else =0 45 46} RemoteXY; 47#pragma pack(pop) 48 49///////////////////////////////////////////// 50// END RemoteXY include // 51///////////////////////////////////////////// 52 53#define PIN_RED_LED 13 54#define PIN_GREEN_LED 12 55#define PIN_BLUE_LED 11 56#define PIN_LAMP 10 57 58 59void setup() 60{ 61 RemoteXY_Init (); 62 63 pinMode (PIN_RED_LED, OUTPUT); 64 pinMode (PIN_GREEN_LED, OUTPUT); 65 pinMode (PIN_BLUE_LED, OUTPUT); 66 pinMode (PIN_LAMP, OUTPUT); 67 68 // TODO you setup code 69 70} 71 72void loop() 73{ 74 RemoteXY_Handler (); 75 76 digitalWrite(PIN_RED_LED, (RemoteXY.RED_LED==0)?LOW:HIGH); 77 digitalWrite(PIN_GREEN_LED, (RemoteXY.GREEN_LED==0)?LOW:HIGH); 78 digitalWrite(PIN_BLUE_LED, (RemoteXY.BLUE_LED==0)?LOW:HIGH); 79 digitalWrite(PIN_LAMP, (RemoteXY.LAMP==0)?LOW:HIGH); 80 81 // TODO you loop code 82 // use the RemoteXY structure for data transfer 83 84 85}
Code
c_cpp
1//www.YouTube.com/Electronics is Fun// 2 3*/ 4 5////////////////////////////////////////////// 6// RemoteXY include library // 7////////////////////////////////////////////// 8 9// RemoteXY select connection mode and include library 10#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT 11 12#include <RemoteXY.h> 13 14// RemoteXY connection settings 15#define REMOTEXY_SERIAL Serial 16#define REMOTEXY_SERIAL_SPEED 115200 17#define REMOTEXY_WIFI_SSID "RemoteXY" 18#define REMOTEXY_WIFI_PASSWORD "********" 19#define REMOTEXY_SERVER_PORT 6377 20 21 22// RemoteXY configurate 23#pragma pack(push, 1) 24uint8_t RemoteXY_CONF[] = 25 { 255,4,0,0,0,64,0,8,165,0, 26 2,0,6,8,22,11,36,26,31,31, 27 79,78,0,79,70,70,0,2,0,62, 28 9,22,11,134,26,31,31,79,78,0, 29 79,70,70,0,2,0,8,38,22,11, 30 203,26,31,31,79,78,0,79,70,70, 31 0,1,0,67,37,12,12,31,31,88, 32 0 }; 33 34// this structure defines all the variables of your control interface 35struct { 36 37 // input variable 38 uint8_t RED_LED; // =1 if switch ON and =0 if OFF 39 uint8_t GREEN_LED; // =1 if switch ON and =0 if OFF 40 uint8_t BLUE_LED; // =1 if switch ON and =0 if OFF 41 uint8_t LAMP; // =1 if button pressed, else =0 42 43 // other variable 44 uint8_t connect_flag; // =1 if wire connected, else =0 45 46} RemoteXY; 47#pragma pack(pop) 48 49///////////////////////////////////////////// 50// END RemoteXY include // 51///////////////////////////////////////////// 52 53#define PIN_RED_LED 13 54#define PIN_GREEN_LED 12 55#define PIN_BLUE_LED 11 56#define PIN_LAMP 10 57 58 59void setup() 60{ 61 RemoteXY_Init (); 62 63 pinMode (PIN_RED_LED, OUTPUT); 64 pinMode (PIN_GREEN_LED, OUTPUT); 65 pinMode (PIN_BLUE_LED, OUTPUT); 66 pinMode (PIN_LAMP, OUTPUT); 67 68 // TODO you setup code 69 70} 71 72void loop() 73{ 74 RemoteXY_Handler (); 75 76 digitalWrite(PIN_RED_LED, (RemoteXY.RED_LED==0)?LOW:HIGH); 77 digitalWrite(PIN_GREEN_LED, (RemoteXY.GREEN_LED==0)?LOW:HIGH); 78 digitalWrite(PIN_BLUE_LED, (RemoteXY.BLUE_LED==0)?LOW:HIGH); 79 digitalWrite(PIN_LAMP, (RemoteXY.LAMP==0)?LOW:HIGH); 80 81 // TODO you loop code 82 // use the RemoteXY structure for data transfer 83 84 85}
Downloadable files
Circuit
Circuit
Comments
Only logged in users can leave comments