1

Topic: No more connection with WiFi after new codes added with NodeMCU

I have found RemoteXY some days ago and it is a very interesting and useful application. I have tried to generate the code for NodeMCU V3 with the control Select. I have uploaded the code in to MCU and all went well. Second step has been to add a simple code in order to test the functionality of Select control function. I have defined 3 constants in order to define 3 different pin as output pin then with a switch-case structure it will set HIGH the pin in correspondence the selection made by controller. After this modification the board weren't no more possible to connected on WiFi network. As test I have commented all the codes added by me and I have added one line per time. Every time I have uploaded the code on the board in order to check the functionality. The problem is appered after adding the pinMode declaration:

pinMode(Pin_A, OUTPUT);
  pinMode(Pin_B, OUTPUT);
  pinMode(Pin_C, OUTPUT);

Follows all the code, anyone have some advice?

// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB
#include <ESP8266WiFi.h>

#include <RemoteXY.h>

// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "FRITZ!Box 7490"
#define REMOTEXY_WIFI_PASSWORD "32189651531398700841"
#define REMOTEXY_SERVER_PORT 6377


#define Pin_A 6
#define Pin_B 7
#define Pin_C 8

// RemoteXY configurate 
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,1,0,0,0,11,0,8,13,1,
  3,3,29,36,8,22,2,26 };
 
// this structure defines all the variables of your control interface
struct {

    // input variable
  uint8_t select_1; // =0 if select position A, =1 if position B, =2 if position C, ...

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

} RemoteXY;
#pragma pack(pop)

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


void setup()
{
  RemoteXY_Init ();

  pinMode(Pin_A, OUTPUT);
  pinMode(Pin_B, OUTPUT);
  pinMode(Pin_C, OUTPUT);
 
  // TODO you setup code

 
}

void loop()
{
  RemoteXY_Handler ();
 
switch (RemoteXY.select_1) {
  case 0:
    digitalWrite(Pin_B, LOW);   
    digitalWrite(Pin_C, LOW);   
    digitalWrite(Pin_A, HIGH);
    delay(1000);
     
    break;
  case 1:
  digitalWrite(Pin_A, LOW);   
    digitalWrite(Pin_C, LOW); 
    digitalWrite(Pin_B, HIGH);
    delay(1000);
    break;
  case 2:
    digitalWrite(Pin_A, LOW);   
    digitalWrite(Pin_B, LOW); 
    digitalWrite(Pin_C, HIGH);
    delay(1000);

    break;
}
 
  // TODO you loop code
  // use the RemoteXY structure for data transfer



}

2 (edited by Guillaume 2018-03-18 10:24:42)

Re: No more connection with WiFi after new codes added with NodeMCU

I think you use the wrong pins. When you write '6' it means GPIO6, but when you write 'D6' (as written on the nodemcu) it actually means GPIO12. GPIO6, 7 and 8 are reserved and connected to the flash chip, this is most likely your problem.

Try:

#define Pin_A D6
#define Pin_B D7
#define Pin_C D8

Also remove these delays.