In this project, we will basic arduino code for espcopter to control espcopter RGB LED.
ESPcopter is currently crowdfunding, with differing reward levels available depending on the expansion boards and quantity desired.
1-) Open the espcopter RemoteXY control code.
2-) Check the standard code
#define REMOTE_XY_OWN
#include "remotexy.h"
#include <espcopter.h> // ESPcopter lib
void setup() {
mainSetup();
}
void loop() {
mainLoop (); // main loop
}
3-) Make a control interface on RemoteXY
4-) Make RemoteXY Settings
4-) Get the RemoteXY Code by click to "Get source code"
5-) Edit the Flying Code by Using SDK
SDK: http://espcopter.com/wp-content/uploads/2016/09/ESPcopter-SDKEnglish.pdf
Main code:
#define REMOTE_XY_OWN
#include "remotexy.h"
#include <espcopter.h> // ESPcopter lib
void setup() {
mainSetup();
esp.greenLed_Digital(0); // switch off the green led
}
void loop() {
mainLoop (); // main loop
if(RemoteXY.button_1 == 1){ // if switch_1 is on do here
esp.redLed_Digital(1);
}else{
esp.redLed_Digital(0);
}
if(RemoteXY.button_2 == 1){ // if switch_1 is on do here
esp.greenLed_Digital(1);
}else{
esp.greenLed_Digital(0);
}
if(RemoteXY.button_3 == 1){ // if switch_1 is on do here
esp.blueLed_Digital(1);
}else{
esp.blueLed_Digital(0);
}
}
remotexy.h//////////////////////////////////////////////
// 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,33,0,8,13,0,
1,0,8,19,22,22,1,31,88,0,
1,0,38,20,22,22,133,31,88,0,
1,0,68,20,21,21,201,31,88,0 };
// this structure defines all the variables of your control interface
struct {
// input variable
uint8_t button_1; // =1 if button pressed, else =0
uint8_t button_2; // =1 if button pressed, else =0
uint8_t button_3; // =1 if button pressed, else =0
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define PIN_BUTTON_1 D4
Result:(Not this code but it is too similar one)
ESPcopter is currently crowdfunding, with differing reward levels available depending on the expansion boards and quantity desired.
Comments
Please log in or sign up to comment.