1

Topic: Button controlling the wrong output pin

There must be a simple solution to this.

My hardware: Arduino Uno, ESP 01, Green LED, Yellow LED

My RemoteXY App: On/Off Switch Green LED pin 12
                              Push button Yellow LED pin 11

My Problem: the green LED switch works fine, but the push button controls the green LED when it is switched on.

I have checked all my wiring and code, it should be fine. How is the button, coded for pin 11 controlling a light that is on pin 12? I did not alter the code from what I copied from RemoteXY.

I was so excited just to get the ESP working talking to my phone, but this has got me totally confused.

my code:


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

#include <RemoteXY.h>

// RemoteXY connection settings
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 115200
#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, 2, 0, 0, 0, 30, 0, 10, 13, 0,
  2, 1, 65, 10, 22, 11, 2, 26, 31, 31,
  79, 78, 0, 79, 70, 70, 0, 1, 0, 29,
  11, 12, 12, 2, 31, 88, 0
};

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

  // input variables
  uint8_t Green; // =1 if switch ON and =0 if OFF
  uint8_t Yellow; // =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_GREEN 12
#define PIN_YELLOW 11


void setup()
{
  RemoteXY_Init ();

  pinMode (PIN_GREEN, OUTPUT);
  pinMode (PIN_YELLOW, OUTPUT);

  // TODO you setup code

}

void loop()
{
  RemoteXY_Handler ();

  digitalWrite(PIN_GREEN, (RemoteXY.Green == 0) ? LOW : HIGH);
  digitalWrite(PIN_YELLOW, (RemoteXY.Yellow == 0) ? LOW : HIGH);

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