Using the 'flash' pins for GPIO

BaartCM
Posts: 17
Joined: Tue Mar 13, 2018 11:55 am

Using the 'flash' pins for GPIO

Postby BaartCM » Thu Mar 22, 2018 4:28 pm

Hi,

I have a NodeMCU ESP32. The pinout diagram shows the following pins, 6,7,8,9,10 & 11 as being connected to the flash. They are also shown as being able to be used for PMW. I would like, if I may ... to use them for inputs so I set up the following code to test them

Code: Select all

int pinButton = 6; //the pin where we connect the button
int LED = 2; //the pin we connect the LED

void setup() {
  pinMode(pinButton, INPUT); //set the button pin as INPUT
  pinMode(LED, OUTPUT); //set the LED pin as OUTPUT
}

void loop() {
  int stateButton = digitalRead(pinButton); //read the state of the button
  if(stateButton == 1) { //if is pressed
     digitalWrite(LED, HIGH); //write 1 or HIGH to led pin
  } else { //if not pressed
     digitalWrite(LED, LOW);  //write 0 or low to led pin
  }
}
Then I changed the pinButton number and tested each pin by connecting it to 3v3 to turn the led on. I found pins 8 and 7 worked. with Pin 6, the led stayed off and with 9,10 and 11, it was on permanently. I remember with the STM32F103, there was a line of code I had to use to disable something and allow me to use a couple of pint on PortB but cant for the life of me remember what. I was wondering if there is something similar I need to do to make these GPIO's accessible for inputs? Can anyone help please?

Steve.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Using the 'flash' pins for GPIO

Postby WiFive » Thu Mar 22, 2018 9:11 pm


Who is online

Users browsing this forum: No registered users and 218 guests