I can't figure out what's wrong about a simple LED sketch and errors being thrown

meretrix
Posts: 4
Joined: Thu Aug 16, 2018 6:38 pm

I can't figure out what's wrong about a simple LED sketch and errors being thrown

Postby meretrix » Wed Aug 29, 2018 11:55 pm

I have a VERY simple LED sketch I was working on because I'm having these weird issues occur. Here is the sketch.

Code: Select all

#define LED_BUILTIN 2
int button = 6; // push button is connected
int temp = 0;    // temporary variable for reading the button pin status

void setup() {
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);   // declare LED as output
  pinMode(button, INPUT); // declare push button as input
}

void loop() {
  
  temp = digitalRead(button);
     
     if (temp == HIGH) {
        //digitalWrite(LED_BUILTIN, HIGH);
        Serial.println("LED Turned ON");
        delay(1000);
       }
     else {
        //digitalWrite(LED_BUILTIN, LOW);
        Serial.println("LED Turned OFF");
        delay(1000);
       }
}
I even commented out the digitalWrite part and just tried to print to serial monitor. This is what the monitor is doing the entire time:

Code: Select all

Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d09a0  PS      : 0x00060330  A0      : 0x800e3e95  A1      : 0x3ffb1f80  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00060023  A5      : 0x3ffc72fc  
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x800d09a0  A9      : 0x3ffb1f60  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x0800001c  A13     : 0x00000003  
A14     : 0x00000001  A15     : 0x00000000  SAR     : 0x00000006  EXCCAUSE: 0x00000000  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

Backtrace: 0x400d09a0:0x3ffb1f80 0x400e3e92:0x3ffb1fa0

Which translates to:

Code: Select all

PC: 0x400d09a0: loop() at C:\Users\Me\Documents\Arduino\ESP32_ButtonTest/ESP32_ButtonTest.ino line 14
EXCVADDR: 0x00000000

Decoding stack results
0x400d09a0: loop() at C:\Users\Me\Documents\Arduino\ESP32_ButtonTest/ESP32_ButtonTest.ino line 14
0x400e3e92: loopTask(void*) at C:\Users\Me\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\cores\esp32\main.cpp line 17
WHAT? What in the WORLD is going on? I'm in constant reboot anytime I try to setup an input on this thing. I'm using a NODE MCU ESP32S dev board. I'm using USB cable and power from my laptop. I'm positive I have the correct pins setup on my breadboard too. HELP?

ESP_Sprite
Posts: 9040
Joined: Thu Nov 26, 2015 4:08 am

Re: I can't figure out what's wrong about a simple LED sketch and errors being thrown

Postby ESP_Sprite » Fri Aug 31, 2018 2:54 am

GPIO6 (which you use for a button) is connected to the flash your program lives in: re-configuring it as an input makes the ESP32 not able to read its program anymore. Pick a different GPIO.

meretrix
Posts: 4
Joined: Thu Aug 16, 2018 6:38 pm

Re: I can't figure out what's wrong about a simple LED sketch and errors being thrown

Postby meretrix » Sat Sep 01, 2018 12:45 am

I looked at the pinout and didn't see anything that mentions pin6 is connected to flash. Where can I find that? Is pin6 normally not usable as an input? Any other pins I should avoid?

chegewara
Posts: 2230
Joined: Wed Jun 14, 2017 9:00 pm

Re: I can't figure out what's wrong about a simple LED sketch and errors being thrown

Postby chegewara » Sat Sep 01, 2018 12:59 am

All pins described as flash xxx(gpio 6,7,8,9,10,11) and of course if you want to debug then program port(gpio 1 and 3):
https://raw.githubusercontent.com/gojim ... pinout.png

Who is online

Users browsing this forum: No registered users and 73 guests