Metehan Emlik
Published © MPL-2.0

RGB Control with ESPcopter

In this project, we will make IoT control app to control ESPcopter's RGB LED by using remoteXY.

BeginnerProtip1 hour622
RGB Control with ESPcopter

Things used in this project

Hardware components

espcopter
×1

Software apps and online services

Arduino IDE
Arduino IDE
remotexy

Story

Read more

Code

ESPcopter RGB Control

Arduino
#define REMOTE_XY_OWN

 
#include "remotexy.h"
#include <espcopter.h>

// ************************************************************************************************************************************

void setup() {
  mainSetup();
  esp.greenLed_Digital(0);
}

void loop() {
    mainLoop();  // main flying 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 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,1,0,0,0,16,0,8,13,0,
  1,0,31,16,33,33,2,31,98,108,
  117,101,0 }; 
   
// this structure defines all the variables of your control interface  
struct { 

    // input variable
  uint8_t button_1; // =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
10 projects • 9 followers
Contact

Comments

Please log in or sign up to comment.