ESP8266 crashes when HTTPClient http; starts

Hi and Greetings of the day.
I am trying to make IoT based Notice Board using ESP8266 and P10 board. For scrolling message i am using DMDESP library. My code is as follows

#include <WiFiClient.h>
WiFiClient ESP8266Client;
#include <ESP8266HTTPClient.h>
#include<ESP8266WiFi.h>
#include <DMDESP.h>
#include <fonts/ElektronMart6x8.h>
#include <fonts/Mono5x7.h>
#define DISPLAYS_WIDE 1
#define DISPLAYS_HIGH 1
DMDESP Disp(DISPLAYS_WIDE, DISPLAYS_HIGH);
int wifi = D0; // WiFi Onboard LED
const char* ssid = "Firoznew";
const char* password = "redrose2020";
String api = "02ac659b1bf89825135712f3772e7809ca9a4c7f";
char *Text[] = {"NodeMCU ESP8266 P10 LED Panel with DMDESP"};
String Incoming_Text = "";
void setup() {
Serial.begin(115200);
pinMode(wifi, OUTPUT);
digitalWrite(wifi, HIGH);
Disp.start();
Disp.setBrightness(40);
Disp.setFont(Mono5x7);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
Serial.println("Connecting to WiFi");
digitalWrite(wifi, LOW); // ON
delay(500);
digitalWrite(wifi, HIGH); // OFF
delay(500);
}
digitalWrite(wifi, LOW);
}

void loop() {
handle_server();
Disp.loop();
Disp.drawText(8, 0, "GPM");
Scrolling_Text(9, 100);
}
void handle_server()
{
HTTPClient http;
http.begin(ESP8266Client, "http://www.techvegan.in/iot-notice-board-api/script.php?api="+api); // Read Status from Cloud
int httpCode = http.GET();
Incoming_Text = http.getString();
Process_Incoming_Text();
httpCode=0;
Serial.flush();
http.end();
}

void Process_Incoming_Text() {
delay(500);
Serial.println("Incoming text : ");
Serial.println(Incoming_Text);
Serial.println();
int str_len = Incoming_Text.length() + 1;
char char_array[str_len];
Incoming_Text.toCharArray(char_array, str_len);
strcpy(Text[0], char_array);
//Serial.println(Text);
Incoming_Text = "";
}

void Scrolling_Text(int y, uint8_t scrolling_speed) {
static uint32_t pM;
static uint32_t x;
int width = Disp.width();
Disp.setFont(Mono5x7);
int fullScroll = Disp.textWidth(Text[0]) + width;
if((millis() - pM) > scrolling_speed) {
pM = millis();
if (x < fullScroll) {
++x;
} else {
x = 0;
return;
}
Disp.drawText(width - x, y, Text[0]);
} }

ESP8266 gets connected to wifi reads message from given URL but it doesn't display the message on P10 board. When i hide the program for HTTPClient and reading the URL, default text message appears on P10 display board. I think the problem may be in interrupt or may be in Timer. Please help.

I don't know if I can help. But I know that unfortunately something went wrong. If you post a message and have a question, always include the code and the error message. Paste the code by clicking on the button (as in the picture) and then paste the code. You should also do the same with the error message. For example, you now have a link ("https://serial.println/") in your code. That shouldn't be, right?
This makes it much easier to help you.

image

However, I also read something about an API key. Have you already entered the correct one here?

Yeah

What do you mean by that?

API key entered is correct one. esp reads the data from given url+ api serial monitor prints the correct data. But when it come to wrrite on P10 display it doesnt show on display. Some pixels flashes only.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.