#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ThingSpeak.h> // Include ThingSpeak library
LiquidCrystal_I2C lcd(0x27,16,2);
// ThingSpeak channel settings
unsigned long channelID = YOUR_CHANNEL_ID; // Replace with your channel ID
const char *apiKey = "20E8MZ9YA434IXMT"; // Replace with your API key
void setup()
{
Wire.begin(23, 22);
Serial.begin(9600);
lcd.init();
lcd.backlight();
ThingSpeak.begin(client); // Initialize ThingSpeak with your client
}
void loop()
{
// Your existing code to read sensor data and display on LCD
// Send data to ThingSpeak
ThingSpeak.writeField(channelID, 1, sensorValue, apiKey); // Assuming sensorValue is the data you want to send
delay(20000); // Wait for 20 seconds before sending next data (ThingSpeak allows updates every 15 seconds)
}