Once I used 3 thermistors and 1 voltage sensor at time on NANO and then connect RX and TX pins with Node MCU and then it uploads data but now its not working.
Even yesterday I take help from Chat GPT but it was nothing positive response
CHAT GPT
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include<ThingSpeak.h>
#include <ESP8266WebServer.h>
const char* ssid = "😹😹😹😹";
const char* password = "***************************";
const char* server = "api.thingspeak.com";
const char* apiKey = "ZTHF537GWI5DEM0N";
WiFiClient client;
void setup() {
Serial.begin(9600);
delay(15000);
// Connect to Wi-Fi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(15000);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
}
void loop() {
// Variables to store temperature values
float temperature1 = 0.0;
float temperature2 = 0.0;
float temperature3 = 0.0;
if (Serial.available() > 0) {
String data = Serial.readStringUntil('\n'); // Read the incoming data as a string
// Parse the incoming data assuming it is in the format "temp1,temp2,temp3"
int commaIndex1 = data.indexOf(',');
int commaIndex2 = data.indexOf(',', commaIndex1 + 1);
if (commaIndex1 > 0 && commaIndex2 > commaIndex1) {
temperature1 = data.substring(0, commaIndex1).toFloat();
temperature2 = data.substring(commaIndex1 + 1, commaIndex2).toFloat();
temperature3 = data.substring(commaIndex2 + 1).toFloat();
// Update ThingSpeak fields
ThingSpeak.setField(1, temperature1);
ThingSpeak.setField(2, temperature2);
ThingSpeak.setField(3, temperature3);
int updateRes = ThingSpeak.writeFields(123456, apiKey); // Replace 123456 with your Channel ID
if (updateRes == OK) {
Serial.println("ThingSpeak update successful");
} else {
Serial.println("Error updating ThingSpeak");
}
} else {
Serial.println("Error parsing temperature data");
}
}
delay(15000); // ThingSpeak allows updates every 15 seconds (900ms min delay)
}