Hi
I intended to follow this tutorial : IoT Based Soil Nutrient Monitoring with Arduino & ESP32. However I found some issue with my ESP32.
The script I follow is this one :
#include <WiFi.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
String apiKey = "3F22P0RWQ1KCVR30";
const char* ssid = "****";
const char* password = "*******";
const char* server = "api.thingspeak.com";
RF24 radio(4, 5);
const uint64_t address = 0xF0F0F0F0E1LL;
struct MyVariable
{
byte pH;
};
MyVariable variable;
WiFiClient client;
void setup()
{
Serial.begin(115200);
radio.begin(); //Starting the Wireless communication
radio.openReadingPipe(0, address); //Setting the address at which we will receive the data
radio.setPALevel(RF24_PA_MIN); //You can set this as minimum or maximum depending on the distance between the transmitter and receiver.
radio.startListening(); //This sets the module as receiver
Serial.println("Receiver Started....");
Serial.print("Connecting to ");
Serial.println(ssid);
Serial.println();
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
}
int recvData()
{
if ( radio.available() )
{
radio.read(&variable, sizeof(MyVariable));
return 1;
}
return 0;
}
void loop()
{
if(recvData())
{
Serial.println("Data Received:");
Serial.print("pH: ");
Serial.print(variable.pH);
Serial.println("pH Value");
Serial.println();
if (client.connect(server, 80))
{
String postStr = apiKey;
postStr += "&field1=";
postStr += String(variable.pH);
postStr += "\r\n";
client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);
delay(1000);
Serial.println("Data Sent to Server");
}
client.stop();
}
}
and Arduino shows me this message :
Several libraries found for "WiFi.h
Used : /Users/****/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFi
In file included from /Users/****/Documents/Arduino/libraries/RF24/RF24.h:18:0,
No used : /private/var/folders/bg/x6005hf93qz8dxf81_0qd8gm0000gn/T/AppTranslocation/43963104-DB68-48AF-B612-676188CB3AD3/d/Arduino.app/Contents/Java/libraries/WiFi
from /Users/****/Documents/Arduino/ghosty_wifi_ph/ghosty_wifi_ph.ino:4:
/Users/****/Documents/Arduino/libraries/RF24/RF24_config.h:51:26: fatal error: avr/pgmspace.h: No such file or directory
compilation completed.
exit status 1
Compilation error for the card DOIT ESP32 DEVKIT V1
My ESP32 is this one : https://www.amazon.fr/gp/product/B08CCYWZN3/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1
Thank you so much !