1

Topic: Automotive Master Door Panel

Uses esp32 ble to control up to 16 momentary switching of 2 8channel isolated relay boards. Led button for testing operation and slide switches for on/off of anything

/*
   -- Door2.1 --

   This source code of graphical user interface
   has been generated automatically by RemoteXY editor.
   To compile this code using RemoteXY library 2.4.3 or later version
   download by link http://remotexy.com/en/library/
   To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
     - for ANDROID 4.5.1 or later version;
     - for iOS 1.4.1 or later version;

   This source code is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.
*/

//////////////////////////////////////////////
//        RemoteXY include library          //
//////////////////////////////////////////////

// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP32CORE_BLE

#include <RemoteXY.h>

// RemoteXY connection settings
#define REMOTEXY_BLUETOOTH_NAME "Bite"


// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255, 17, 0, 0, 0, 30, 1, 10, 24, 2,
  1, 5, 39, 5, 12, 9, 17, 15, 12, 8,
  134, 31, 76, 111, 99, 107, 0, 1, 6, 52,
  6, 12, 8, 30, 15, 14, 8, 177, 31, 85,
  78, 0, 1, 6, 26, 14, 12, 12, 24, 29,
  12, 12, 205, 31, 85, 112, 0, 1, 5, 25,
  27, 12, 12, 24, 44, 12, 12, 204, 31, 68,
  110, 0, 1, 6, 65, 15, 12, 12, 46, 29,
  12, 12, 204, 31, 85, 112, 0, 1, 5, 65,
  28, 12, 12, 47, 44, 12, 12, 204, 31, 68,
  110, 0, 1, 6, 38, 34, 12, 12, 24, 61,
  12, 12, 204, 31, 85, 112, 0, 1, 6, 52,
  34, 12, 12, 46, 61, 12, 12, 205, 31, 85,
  112, 0, 1, 5, 38, 47, 12, 12, 24, 76,
  12, 12, 205, 31, 68, 110, 0, 1, 5, 52,
  47, 12, 12, 46, 76, 12, 12, 205, 31, 68,
  110, 0, 1, 4, 10, 6, 10, 10, 26, 3,
  9, 9, 191, 31, 76, 69, 68, 0, 1, 6,
  9, 43, 7, 7, 4, 71, 9, 9, 2, 31,
  111, 60, 68, 0, 1, 5, 9, 36, 6, 6,
  6, 62, 8, 8, 36, 31, 82, 85, 78, 0,
  1, 1, 9, 51, 6, 6, 6, 83, 9, 9,
  2, 31, 66, 108, 105, 110, 107, 0, 2, 0,
  2, 30, 21, 5, 3, 51, 16, 5, 1, 26,
  31, 31, 53, 86, 0, 79, 70, 70, 0, 2,
  0, 2, 24, 21, 5, 3, 45, 16, 5, 94,
  26, 29, 31, 49, 50, 86, 0, 79, 70, 70,
  0, 2, 0, 2, 18, 21, 5, 2, 38, 18,
  6, 93, 26, 31, 31, 65, 85, 88, 0, 79,
  70, 70, 0
};

// this structure defines all the variables and events of your control interface
struct {

  // input variables
  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
  uint8_t button_4; // =1 if button pressed, else =0
  uint8_t button_5; // =1 if button pressed, else =0
  uint8_t button_6; // =1 if button pressed, else =0
  uint8_t button_7; // =1 if button pressed, else =0
  uint8_t button_8; // =1 if button pressed, else =0
  uint8_t button_9; // =1 if button pressed, else =0
  uint8_t button_10; // =1 if button pressed, else =0
  uint8_t button_11; // =1 if button pressed, else =0
  uint8_t button_12; // =1 if button pressed, else =0
  uint8_t button_13; // =1 if button pressed, else =0
  uint8_t button_14; // =1 if button pressed, else =0
  uint8_t switch_1; // =1 if switch ON and =0 if OFF
  uint8_t switch_2; // =1 if switch ON and =0 if OFF
  uint8_t switch_3; // =1 if switch ON and =0 if OFF

  // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////

#define PIN_BUTTON_1 21
#define PIN_BUTTON_2 19
#define PIN_BUTTON_3 14
#define PIN_BUTTON_4 12
#define PIN_BUTTON_5 15
#define PIN_BUTTON_6 4
#define PIN_BUTTON_7 5
#define PIN_BUTTON_8 16
#define PIN_BUTTON_9 18
#define PIN_BUTTON_10 17
#define PIN_BUTTON_11 2
#define PIN_BUTTON_12 25
#define PIN_BUTTON_13 26
#define PIN_BUTTON_14 33
#define PIN_SWITCH_1 13
#define PIN_SWITCH_2 27
#define PIN_SWITCH_3 32


void setup()
{
  RemoteXY_Init ();

  pinMode (PIN_BUTTON_1, OUTPUT);
  pinMode (PIN_BUTTON_2, OUTPUT);
  pinMode (PIN_BUTTON_3, OUTPUT);
  pinMode (PIN_BUTTON_4, OUTPUT);
  pinMode (PIN_BUTTON_5, OUTPUT);
  pinMode (PIN_BUTTON_6, OUTPUT);
  pinMode (PIN_BUTTON_7, OUTPUT);
  pinMode (PIN_BUTTON_8, OUTPUT);
  pinMode (PIN_BUTTON_9, OUTPUT);
  pinMode (PIN_BUTTON_10, OUTPUT);
  pinMode (PIN_BUTTON_11, OUTPUT);
  pinMode (PIN_BUTTON_12, OUTPUT);
  pinMode (PIN_BUTTON_13, OUTPUT);
  pinMode (PIN_BUTTON_14, OUTPUT);
  pinMode (PIN_SWITCH_1, OUTPUT);
  pinMode (PIN_SWITCH_2, OUTPUT);
  pinMode (PIN_SWITCH_3, OUTPUT);

  // TODO you setup code

}

void loop()
{
  RemoteXY_Handler ();

  digitalWrite(PIN_BUTTON_1, (RemoteXY.button_1 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_2, (RemoteXY.button_2 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_3, (RemoteXY.button_3 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_4, (RemoteXY.button_4 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_5, (RemoteXY.button_5 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_6, (RemoteXY.button_6 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_7, (RemoteXY.button_7 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_8, (RemoteXY.button_8 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_9, (RemoteXY.button_9 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_10, (RemoteXY.button_10 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_11, (RemoteXY.button_11 == 0) ? LOW : HIGH);
  digitalWrite(PIN_BUTTON_12, (RemoteXY.button_12 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_13, (RemoteXY.button_13 == 0) ? HIGH : LOW);
  digitalWrite(PIN_BUTTON_14, (RemoteXY.button_14 == 0) ? HIGH : LOW);
  digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1 == 0) ? HIGH : LOW);
  digitalWrite(PIN_SWITCH_2, (RemoteXY.switch_2 == 0) ? HIGH : LOW);
  digitalWrite(PIN_SWITCH_3, (RemoteXY.switch_3 == 0) ? HIGH : LOW);

  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay()


}