Arduino does not start with a connected Reed contact

Hi everybody,

I am facing a weird problem.

Board: ESP8266MOD 12-F
Reed Contact Switch Opener connected to D8 and V3.3V

If Opener is open while rest or power on, the Arduino boots and works fine.

If Opener is closed while reset or power on, the Arduino will not boot.

I have tried to connect the Opener switch to D( and GND. The boot process is fine, but I cant detect the state of the opener switch.

int led = LED_BUILTIN;                            
int button = 8;                         
int buttonStatus;                       
int ledAn  = 500;
int ledAus = 500;

void setup() {
  pinMode(led, OUTPUT);                    
  pinMode(button, INPUT);                  
  digitalWrite(button, HIGH);               
}

 

void loop () {

  buttonStatus = digitalRead(button);       
  if(buttonStatus == LOW)                   
  {
     digitalWrite(led, HIGH);               
     delay(ledAn);
     digitalWrite(led, LOW);
     delay(ledAus);
  }

  else                                      
                                           
  {                                        
     digitalWrite(led, LOW);               
  }

}

@4heisenberg

Schematic and pictures please ?

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

I have attached 2 photographs showing, while it works, to show schematics.

When I boot when the switch is open, it works. When I close the switch the LED is on.

If I try to boot with the switch closed, it will not even boot.

int led = LED_BUILTIN;
int button = D8;
int buttonStatus = 0;

void setup() {
  pinMode(led, OUTPUT);
  pinMode(button, INPUT);
  digitalWrite(button, HIGH);

  Serial.begin(9600);
}
void loop () {
  buttonStatus = digitalRead(button);
  Serial.println (buttonStatus);
  if (buttonStatus == LOW)
  {
    digitalWrite(led, HIGH);
  }

  else
  {
    digitalWrite(led, LOW);
  }
  delay (1000);
}

I’m unsure which pins , but certain pins have to be in a certain state to allow the 8266 to boot as those pins have multiple purposes , such as for programming .

This link states it will not boot if D8 is high :

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.