Hi,
I'm working with ESP wroom-32 and I can't get some GPIOs working. I have the same circuit connected to GPIOs 5, 17, 18 and 19, but the only one working is the one connected to GPIO5. I tried both Arduino IDE and ESP IDF, but hte problem stays the same.
Here's my code from ESp IDF:
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
#define RELAY1 17
#define RELAY2 5
#define RELAY3 18
#define RELAY4 19
void app_main(void) {
gpio_reset_pin(RELAY1);
gpio_reset_pin(RELAY2);
gpio_reset_pin(RELAY3);
gpio_reset_pin(RELAY4);
gpio_set_direction(RELAY1, GPIO_MODE_OUTPUT);
gpio_set_direction(RELAY2, GPIO_MODE_OUTPUT);
gpio_set_direction(RELAY3, GPIO_MODE_OUTPUT);
gpio_set_direction(RELAY4, GPIO_MODE_OUTPUT);
while (1) {
gpio_set_level(RELAY1, 1);
gpio_set_level(RELAY2, 1);
gpio_set_level(RELAY3, 1);
gpio_set_level(RELAY4, 1);
printf("on\n");
vTaskDelay(1000 / portTICK_PERIOD_MS);
gpio_set_level(RELAY1, 0);
gpio_set_level(RELAY2, 0);
gpio_set_level(RELAY3, 0);
gpio_set_level(RELAY4, 0);
printf("off\n");
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
And here's the one from Arduino IDE:
int sw1 = 17;
int sw2 = 5;
int sw3 = 18;
int sw4 = 19;
void setup() {
Serial.begin(115200);
pinMode(sw1, OUTPUT);
pinMode(sw2, OUTPUT);
pinMode(sw3, OUTPUT);
pinMode(sw4, OUTPUT);
}
void loop() {
Serial.println("on");
digitalWrite(sw1, HIGH);
digitalWrite(sw2, HIGH);
digitalWrite(sw3, HIGH);
digitalWrite(sw4, HIGH);
delay(1000);
Serial.println("off");
digitalWrite(sw1, LOW);
digitalWrite(sw2, LOW);
digitalWrite(sw3, LOW);
digitalWrite(sw4, LOW);
delay(1000);
}
The voltage at GPIO5 rises to 3v3 and falls back down as it should, but the other ones stay at 0v. I'm not sure if any other pins have problems, or it's just the three, but I can test them. Am I doing something wrong?