#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "syntell wireless ";
const char* password = "$ynWifi001";
const char* serverName = "http://api.thingspeak.com/update";
String apiKey = "your_API_KEY";
const int flowSensorPin = 4;
volatile int pulseCount = 0;
float flowRate;
unsigned long totalMilliLitres = 0;
unsigned long oldTime = 0;
// Interrupt Service Routine (ISR) for counting pulses
void IRAM_ATTR pulseCounter() {
pulseCount++;
}
void setup() {
Serial.begin(115200);
pinMode(flowSensorPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(flowSensorPin), pulseCounter, FALLING);
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
…