Which board should I select for ESP32-WROOM-32E?
Posted: Tue Dec 21, 2021 8:03 am
Dear All,
I've start to use the ESP32 with Arduino IDE.
All instruction for install to use ESP on Arduino is cleared.
Compile and download is OK.
But not work the GPIO.
Below is the code. It's simple. Just swing the GPIO.
I've select the board 'ESP32 Wrover Module'.
Which board should I select for ESP32-WROOM-32E board? I also tried 'ESP32 Dev Module'. I'ts same.
Arduino IDE 1.8.15. and all other's default settings.
Please advice to me. Thank you.
----------------------------------------------------
#include <SimpleTimer.h>
#include "BluetoothSerial.h"
// GPIO
#define GPO_ALIVE 36 // Pin 4
#define GPO_RELAY 34 // Pin 6
#define GPO_RELAY_OFF 35 // Pin 7
#define GPO_LED1 32 // Pin 8
#define GPO_LED2 33 // Pin 9
#define GPO_LED3 25 // Pin 10
#define GPO_BUZZER 11 // Pin 19
#define ADC_TEMP_IN 2 // Pin 24
BluetoothSerial SerialBT;
SimpleTimer timer10ms;
SimpleTimer timerWDT;
int toggle;
void setup() {
Serial.begin(115200); // Debug
Serial2.begin(115200); // Communicate with PIC
SerialBT.begin("GL-tmp0001"); //Bluetooth device name
`
Serial.println("GL project start");
pinMode(GPO_ALIVE, OUTPUT);
pinMode(GPO_RELAY, OUTPUT);
pinMode(GPO_RELAY_OFF, OUTPUT);
timer10ms.setInterval(1000);
timerWDT.setInterval(1);
}
void loop()
{
digitalWrite(GPO_ALIVE, !digitalRead(GPO_ALIVE));
if(timer10ms.isReady())
{
timer_isr_10ms();
timer10ms.reset();
}
if(timerWDT.isReady())
{
timer_isr_WDT();
timerWDT.reset();
}
}
void timer_isr_WDT()
{
digitalWrite(GPO_ALIVE, !digitalRead(GPO_ALIVE));
}
void timer_isr_10ms()
{
if(toggle != 0)
{
toggle = 0;
Serial.println("RELAY ON");
digitalWrite(GPO_RELAY, HIGH);
digitalWrite(GPO_RELAY_OFF, HIGH);
digitalWrite(GPO_LED1, HIGH);
digitalWrite(GPO_LED2, HIGH);
digitalWrite(GPO_LED3, HIGH);
}
else
{
toggle = 1;
Serial.println("RELAY OFF");
digitalWrite(GPO_RELAY, LOW);
digitalWrite(GPO_RELAY_OFF, LOW);
digitalWrite(GPO_LED1, LOW);
digitalWrite(GPO_LED2, LOW);
digitalWrite(GPO_LED3, LOW);
}
}
I've start to use the ESP32 with Arduino IDE.
All instruction for install to use ESP on Arduino is cleared.
Compile and download is OK.
But not work the GPIO.
Below is the code. It's simple. Just swing the GPIO.
I've select the board 'ESP32 Wrover Module'.
Which board should I select for ESP32-WROOM-32E board? I also tried 'ESP32 Dev Module'. I'ts same.
Arduino IDE 1.8.15. and all other's default settings.
Please advice to me. Thank you.
----------------------------------------------------
#include <SimpleTimer.h>
#include "BluetoothSerial.h"
// GPIO
#define GPO_ALIVE 36 // Pin 4
#define GPO_RELAY 34 // Pin 6
#define GPO_RELAY_OFF 35 // Pin 7
#define GPO_LED1 32 // Pin 8
#define GPO_LED2 33 // Pin 9
#define GPO_LED3 25 // Pin 10
#define GPO_BUZZER 11 // Pin 19
#define ADC_TEMP_IN 2 // Pin 24
BluetoothSerial SerialBT;
SimpleTimer timer10ms;
SimpleTimer timerWDT;
int toggle;
void setup() {
Serial.begin(115200); // Debug
Serial2.begin(115200); // Communicate with PIC
SerialBT.begin("GL-tmp0001"); //Bluetooth device name
`
Serial.println("GL project start");
pinMode(GPO_ALIVE, OUTPUT);
pinMode(GPO_RELAY, OUTPUT);
pinMode(GPO_RELAY_OFF, OUTPUT);
timer10ms.setInterval(1000);
timerWDT.setInterval(1);
}
void loop()
{
digitalWrite(GPO_ALIVE, !digitalRead(GPO_ALIVE));
if(timer10ms.isReady())
{
timer_isr_10ms();
timer10ms.reset();
}
if(timerWDT.isReady())
{
timer_isr_WDT();
timerWDT.reset();
}
}
void timer_isr_WDT()
{
digitalWrite(GPO_ALIVE, !digitalRead(GPO_ALIVE));
}
void timer_isr_10ms()
{
if(toggle != 0)
{
toggle = 0;
Serial.println("RELAY ON");
digitalWrite(GPO_RELAY, HIGH);
digitalWrite(GPO_RELAY_OFF, HIGH);
digitalWrite(GPO_LED1, HIGH);
digitalWrite(GPO_LED2, HIGH);
digitalWrite(GPO_LED3, HIGH);
}
else
{
toggle = 1;
Serial.println("RELAY OFF");
digitalWrite(GPO_RELAY, LOW);
digitalWrite(GPO_RELAY_OFF, LOW);
digitalWrite(GPO_LED1, LOW);
digitalWrite(GPO_LED2, LOW);
digitalWrite(GPO_LED3, LOW);
}
}