Metehan Emlik
Published © MPL-2.0

Make an ESPcopter Remote App

In this project we will make a drone control app by using remotexy for ESPcopter.

BeginnerProtip1 hour1,424
Make an ESPcopter Remote App

Things used in this project

Hardware components

espcopter
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Untitled file

Arduino
#define REMOTE_XY_OWN
#include "remotexy.h"
#include <espcopter.h>
// ************************************************************************************************************************************
int controlButton_1 = 0;
int controlButton_2 = 0;
void setup() {
 mainSetup();
 Trim_Roll = 0; // -1750, 1750
 Trim_Pitch = 0; // -1750, 1750
 Trim_Yaw = 0;  // -1750, 1750
}
void loop() {
  mainLoop();  // main flying loop
  if(RemoteXY.switch_1 == 1){ // if switch_1 is on do here
  armControl =1;
    if(RemoteXY.button_2 == 1){
    SetPointOpt[1] = -15;
    }else if(RemoteXY.button_3 == 1){
    SetPointOpt[1] = 15;
    }else{
    SetPointOpt[1] = 0;
    }
if(RemoteXY.button_4 == 1){
    SetPointOpt[0] = 15;
    }else if(RemoteXY.button_5 == 1){
    SetPointOpt[0] = -15;
    }else{
    SetPointOpt[0] = 0;
    }
  takeOff(500, 25000); //Take off 500 altitude for 25 seconds 
  land();//land 
  }else{ // if switch_1 is off do here
  armControl = 0; // close the motors
}
}
//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,5,0,0,0,71,0,8,13,0,
 2,0,9,6,29,17,2,26,31,31,
 79,78,0,79,70,70,0,1,0,57,
 7,21,21,2,31,105,108,101,114,105,
 0,1,0,57,38,22,22,2,31,103,
 101,114,105,0,1,0,39,25,18,18,
 2,31,115,111,108,0,1,0,78,24,
 19,19,2,31,115,97,103,0 }; 
// this structure defines all the variables of your control interface  
struct { 
   // input variable
 uint8_t switch_1; // =1 if switch ON and =0 if OFF 
 uint8_t button_2; // =1 if button pressed, else =0 
 uint8_t button_3; // =1 if button pressed, else =0 
 uint8_t button_4; // =1 if button pressed, else =0 
 uint8_t button_5; // =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          // 
///////////////////////////////////////////// 

Credits

Metehan Emlik

Metehan Emlik

10 projects • 9 followers

Comments