Sketch uses 1314058 bytes (100%) of program storage space. Maximum is 1310720 bytes.text section exceeds available space in board
Global variables use 51780 bytes (15%) of dynamic memory, leaving 275900 bytes for local variables. Maximum is 327680 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board ESP32 Dev Module.
Can someone help me with this Error? under is the code. I am trying things but nothing is working...
#include <ThingSpeak.h> // add librery
#include <WiFi.h>
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
WiFiClient client;
unsigned long counterChannelNumber = 1; // Channel ID
const char * myCounterReadAPIKey = ""; // Read API Key
const int FieldNumber1 = 1; // The field you wish to read
String ssid_pass;
char *SSID1 = "";
char *PASS = "";
String ssid;
String pass;
const int LED1 = 12;
const int LED_BT = 13;
const int SW = 14;
bool flag = false;
void setup()
{
pinMode(LED1,OUTPUT);
pinMode(LED_BT,OUTPUT);
pinMode(SW,INPUT_PULLUP);
Serial.begin(115200);
Serial.println();
WiFi.begin(SSID1, PASS); // write wifi name & password
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected, IP address: ");
Serial.println(WiFi.localIP());
ThingSpeak.begin(client);
if(!SerialBT.begin("ESP32"))
{
Serial.println("An error occurred initializing Bluetooth");
}
}
void loop()
{
digitalWrite(LED_BT, LOW);
int input = digitalRead(SW);
Serial.print("input: ");Serial.println(input);
if(input == 0)
{
delay(50);
flag = true;
digitalWrite(LED_BT, HIGH);
}
while(flag == true)
{
while(SerialBT.available())
{
ssid_pass = SerialBT.readString();
//Serial.write(SerialBT.read());
Serial.println(ssid_pass);
for (int i = 0; i < ssid_pass.length(); i++)
{
if (ssid_pass.substring(i, i+1) == ",")
{
ssid = ssid_pass.substring(0, i);
pass = ssid_pass.substring(i+1);
Serial.print("SSID = ");Serial.println(ssid);
Serial.print("Password = ");Serial.println(pass);
delay(2000);
flag = false;
int n1 = ssid.length();
char char_array1[n1 + 1];
strcpy(char_array1, ssid.c_str());
int n2 = pass.length();
char char_array2[n2 + 1];
strcpy(char_array2, pass.c_str());
WiFi.begin(char_array1, char_array2); // write wifi name & password
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected, IP address: ");
Serial.println(WiFi.localIP());
ThingSpeak.begin(client);
break;
}
}
}
}
int A = ThingSpeak.readLongField(counterChannelNumber, FieldNumber1, myCounterReadAPIKey);
Serial.println(A);
digitalWrite(LED1,A);
}