Hi everyone, im making a code for ESP32CAM that recieves information from an arduino uno vía serial, im using the Rx/Tx ports of the ESP to program and display the info in the serial monitor, so i needed other pins to recibe and transmit information from/to an arduino, i used HardwareSerial to make pins 14 and 16 of ESP32CAM an extra pair of communication pins and it worked. Then i needed to connect firebase realtime database to the ESP32CAM, and i use a code that worked well without the hardwareserial, but when i try to use both the system starts rebooting (i imagine that is because a memory transgression, but i dont know). This is the code in the ESP32CAM, arduino send information of temperature and humidity in order. So, again , both codes work well alone, but together starts rebooting, what can i do?
#include <HardwareSerial.h>
#include <String.h>
#include <common.h>
#include <Firebase.h>
#include <FirebaseESP32.h>
#include <FirebaseFS.h>
#include <Utils.h>
#include <WiFi.h>
#define RXD2 16
#define TXD2 14
#define WIFI_SSID "MYWIFI"
#define WIFI_PASSWORD "MYPASSWORD"
#define FIREBASE_HOST "MYHOST"
#define FIREBASE_APIKEY "MYAPIKEY"
FirebaseData firebaseData;
HardwareSerial Serialinterno ( 1 );
String FromSerial;
void ToFirebase(String Path, String Value);
void setup() {
Serial.begin(115200);
Serialinterno.begin(9600,SERIAL_8N1,RXD2,TXD2);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Conectando a ....");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Conectado con la IP: ");
Serial.println(WiFi.localIP());
Serial.println();
Firebase.begin(FIREBASE_HOST, FIREBASE_APIKEY);
Firebase.reconnectWiFi(true);
}
void loop() {
while (Serialinterno.available() > 0) {
FromSerial= Serialinterno.readStringUntil('\n');
FromSerial.trim();
if(FromSerial=="Temperature"){
String Temp = Serialinterno.readStringUntil('\n');
Temp.trim();
Serial.println("Temperatura: "+Temp);
ToFirebase("/Temp",Temp.toInt());
}
if(FromSerial=="Humidity"){
String Hum = Serialinterno.readStringUntil('\n');
Hum.trim();
Serial.println("Humedad: "+Hum);
ToFirebase("/Hum",Hum.toInt());
}
}
}
void ToFirebase(String Path, int Value){
if(Firebase.ready()){
Firebase.setInt(firebaseData,Path,Value);
}
}
The error is this:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13132
load:0x40080400,len:3036
entry 0x400805e4
Conectando a ........
Conectado con la IP: (MY IP)
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x40092399 PS : 0x00060d30 A0 : 0x80092c26 A1 : 0x3ffb2670
A2 : 0xffffffff A3 : 0xffffffff A4 : 0x3ffb27dc A5 : 0x3ffcd628
A6 : 0x00000033 A7 : 0x3ffcd5f0 A8 : 0x00000010 A9 : 0x00000000
A10 : 0x0000000f A11 : 0x00000040 A12 : 0x00000000 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000015 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000013 LBEG : 0x4008b969 LEND : 0x4008b979 LCOUNT : 0xfffffff2
Backtrace:0x40092396:0x3ffb26700x40092c23:0x3ffb2690 0x40092ea4:0x3ffb26b0 0x40083c02:0x3ffb26d0 0x40083c15:0x3ffb2700 0x400e735d:0x3ffb2720 0x400d270a:0x3ffb2740 0x400d273a:0x3ffb2760 0x400d298e:0x3ffb2780 0x400d2ad6:0x3ffb27a0 0x400e965a:0x3ffb2820
ELF file SHA256: 0000000000000000
Rebooting...