⭕Arduino + FC-28 (YL-69)+ esp01 + telegram
#include <UniversalTelegramBot.h>
// Replace with your network credentials const char* ssid = "your_SSID"; const char* password = "your_PASSWORD"; // Initialize Telegram BOT #define BOTtoken "your_BOT_TOKEN" // your Bot Token (Get from Botfather) WiFiClient espClient; UniversalTelegramBot bot(BOTtoken, espClient); // Define the sensor pin #define SENSOR_PIN A0 void setup() { Serial.begin(115200); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting to WiFi..."); } Serial.println("Connected to WiFi"); } void loop() { if (WiFi.status() == WL_CONNECTED) { int sensorValue = analogRead(SENSOR_PIN); String msg = "Soil moisture: " + String(sensorValue); bot.sendMessage(your_CHAT_ID, msg, ""); delay(1000); } }
Комментарии
Отправить комментарий