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
}
}
Steve.