I am trying to run a simple wifiClient example from https://learn.sparkfun.com/tutorials/esp32-thing-plus-hookup-guide, I have tried even the inbuilt examples but still, I get the same output on the serial monitor. I am using a ESP32 Devkit module This is the code I used
#include <WiFi.h>
// WiFi network name and password:
const char * networkName = "YOUR_NETWORK_HERE";
const char * networkPswd = "YOUR_PASSWORD_HERE";
// Internet domain to request from:
const char * hostDomain = "example.com";
const int hostPort = 80;
const int BUTTON_PIN = 0;
const int LED_PIN = 13;
void setup()
{
// Initilize hardware:
Serial.begin(115200);
pinMode(BUTTON_PIN, INPUT_PULLUP);
pinMode(LED_PIN, OUTPUT);
// Connect to the WiFi network (see function below loop)
connectToWiFi(networkName, networkPswd);
digitalWrite(LED_PIN, LOW); // LED off
Serial.print("Press button 0 to connect to ");
Serial.println(hostDomain);
}
void loop()
{
if (digitalRead(BUTTON_PIN) == LOW)
{ // Check if button has been pressed
while (digitalRead(BUTTON_PIN) == LOW)
; // Wait for button to be released
digitalWrite(LED_PIN, HIGH); // Turn on LED
requestURL(hostDomain, hostPort); // Connect to server
digitalWrite(LED_PIN, LOW); // Turn off LED
}
}
void connectToWiFi(const char * ssid, const char * pwd)
{
int ledState = 0;
printLine();
Serial.println("Connecting to WiFi network: " + String(ssid));
WiFi.begin(ssid, pwd);
while (WiFi.status() != WL_CONNECTED)
{
// Blink LED while we're connecting:
digitalWrite(LED_PIN, ledState);
ledState = (ledState + 1) % 2; // Flip ledState
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("WiFi connected!");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void requestURL(const char * host, uint8_t port)
{
printLine();
Serial.println("Connecting to domain: " + String(host));
// Use WiFiClient class to create TCP connections
WiFiClient client;
if (!client.connect(host, port))
{
Serial.println("connection failed");
return;
}
Serial.println("Connected!");
printLine();
// This will send the request to the server
client.print((String)"GET / HTTP/1.1\r\n" +
"Host: " + String(host) + "\r\n" +
"Connection: close\r\n\r\n");
unsigned long timeout = millis();
while (client.available() == 0)
{
if (millis() - timeout > 5000)
{
Serial.println(">>> Client Timeout !");
client.stop();
return;
}
}
// Read all the lines of the reply from server and print them to Serial
while (client.available())
{
String line = client.readStringUntil('\r');
Serial.print(line);
}
Serial.println();
Serial.println("closing connection");
client.stop();
}
void printLine()
{
Serial.println();
for (int i=0; i<30; i++)
Serial.print("-");
Serial.println();
}
This is the Serial output
------------------------------
Connecting to domain: example.com
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x401130e8: ea6825e4 f01d062d 82004136
Core 1 register dump:
PC : 0x401130ee PS : 0x00060e30 A0 : 0x00000000 A1 : 0x3ffb1d20
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x3ffb1dbc A5 : 0x3ffb1db4
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000000 A9 : 0x3ffb1d00
A10 : 0x00000001 A11 : 0x00000000 A12 : 0x3ffb99c8 A13 : 0x00000000
A14 : 0x00000000 A15 : 0x00000003 SAR : 0x0000000a EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Backtrace: 0x401130ee:0x3ffb1d20 0x7ffffffd:0x3ffb1d80 0x400fc0b7:0x3ffb1e00 0x4012908d:0x3ffb1e50 0x400d1f35:0x3ffb1e70 0x400d15ca:0x3ffb1ed0 0x4013c7e5:0x3ffb1f00 0x400d133d:0x3ffb1f20 0x400d14e2:0x3ffb1f90 0x400d3e69:0x3ffb1fb0 0x40088b7d:0x3ffb1fd0
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
------------------------------
Connecting to WiFi network: iBall-Baton-1
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 2 - STA_START
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e94bc: 5bc60060 10646300 f03df03d
Core 0 register dump:
PC : 0x400e94c1 PS : 0x00060830 A0 : 0x800f59f3 A1 : 0x3ffb54b0
A2 : 0x3ffba470 A3 : 0x3ffcb34c A4 : 0x3ffb5510 A5 : 0x0000003d
A6 : 0x3ffcb409 A7 : 0x3ffcb3ca A8 : 0x0000002d A9 : 0x0000002d
A10 : 0x0000000d A11 : 0x00000001 A12 : 0x0000001a A13 : 0x3ffcb576
A14 : 0x00004824 A15 : 0x00000007 SAR : 0x00000018 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Backtrace: 0x400e94c1:0x3ffb54b0 0x400f59f0:0x3ffb5500
Rebooting...
ets Jun 8 2016 00:22:57
I have removed the SSID and password.
User contributions licensed under CC BY-SA 3.0