chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

電子發(fā)燒友App

硬聲App

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示
創(chuàng)作
電子發(fā)燒友網(wǎng)>電子資料下載>電子資料>使用Wemos D1 Mini使用Telegram應(yīng)用程序進(jìn)行智能家居控制

使用Wemos D1 Mini使用Telegram應(yīng)用程序進(jìn)行智能家居控制

2022-12-29 | zip | 0.00 MB | 次下載 | 免費

資料介紹

描述

Telegram bot 是應(yīng)用程序編程接口或也稱為“API,它允許程序員在本教程案例中同時集成兩個不同的應(yīng)用程序,稱為帶有 ESP8266 的聊天應(yīng)用程序 Telagram。

由于 TelegramBOT API 令牌的存在,它可以連接在電報聊天和硬件系統(tǒng)之間,例如,它將集成在使用 Arduino IDE 編程的迷你 Wemos D1 與此應(yīng)用程序之間。

該項目使用了電報機器人 API 和 Wemos,將用于制作智能家居來控制燈和門。

1. 安裝 Telegram 機器人庫

2.源代碼

#include 
#include 
#include 
#include 
Servo myservo;
char ssid[] = "KAMAR KOS 7";     // your network SSID (name)
char password[] = "dasarlemahkaunak"; // your network key
#define BOTtoken "883873080:AAGkP-oNlzMgOS44X1jhE43C0_9JwwMCBPw"  // your Bot Token (Get from Botfather)
WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);
int Bot_mtbs = 1000; //mean time between scan messages
long Bot_lasttime;   //last time messages’ scan has been done
bool Start = false;
  
const int ledPin1 = 0;
const int ledPin2 = 2;
int ledStatus = 0;
void handleNewMessages(int numNewMessages) {
 Serial.print("status pesan = ");
 Serial.print(String(numNewMessages));
 Serial.println(",pesan berhasil diterima\n");
 for (int i=0; i   String chat_id = String(bot.messages[i].chat_id);
   String text = bot.messages[i].text;
   String from_name = bot.messages[i].from_name;
   if (from_name == "") from_name = "Guest";
   if (text == "/led1on") {
     digitalWrite(ledPin1, HIGH);   // turn the LED on (HIGH is the voltage level)
     digitalWrite(ledPin2, LOW);
     ledStatus = 1;
     bot.sendMessage(chat_id, "Led 1 is ON", "");
   }
   if (text == "/led1off") {
     ledStatus = 0;
     digitalWrite(ledPin1, LOW);    // turn the LED off (LOW is the voltage level)
     bot.sendMessage(chat_id, "Led 1 is OFF", "");
   }
   if (text == "/led2on") {
     digitalWrite(ledPin2, HIGH);
     digitalWrite(ledPin1, LOW);// turn the LED on (HIGH is the voltage level)
     ledStatus = 1;
     bot.sendMessage(chat_id, "Led 2 is ON", "");
   }
   if (text == "/led2off") {
     ledStatus = 0;
     digitalWrite(ledPin2, LOW);    // turn the LED off (LOW is the voltage level)
     bot.sendMessage(chat_id, "Led 2 is OFF", "");
   }
   if (text == "/alloff") {
     digitalWrite(ledPin1, LOW);
     digitalWrite(ledPin2, LOW);    // turn the LED off (LOW is the voltage level)
     bot.sendMessage(chat_id, "All led is OFF", "");
   }
   if (text == "/allon") {
     digitalWrite(ledPin1, HIGH);
     digitalWrite(ledPin2, HIGH);    // turn the LED off (LOW is the voltage level)
     bot.sendMessage(chat_id, "All led is ON", "");
   }
   if (text == "/rules") {
     bot.sendMessage(chat_id, "Perintah yang dapat diproses adalah perintah yang tertera dalam menu /help, Akep_bot juga tidak mentolerir adanya kesalahan pengetikan.","");
   }
   if (text == "Akep") {
     bot.sendMessage(chat_id, "Hai " + from_name + " aku disini, ketikan /start untuk memulai bot");
   }
   if (text == "/status1") {
     if(ledStatus){
       bot.sendMessage(chat_id, "Led is ON", "");
     } else {
       bot.sendMessage(chat_id, "Led is OFF", "");
     }
   }
      if (text == "/status2") {
     if(ledStatus){
       bot.sendMessage(chat_id, "Led is ON", "");
     } else {
       bot.sendMessage(chat_id, "Led is OFF", "");
     }
   }
   if (text == "/start") {
     bot.sendMessage(chat_id,"Selamat datang di Aplikasi Bot Telegram\n hai "+ from_name +", ketikkan /help untuk melihat perintah apa saja yang tersedia pada bot");
   }
   if (text == "/help") {
     String welcome = "Hai " + from_name + " :) \n";
     welcome += "berikut perintah yang tersedia pada bot\n";
     welcome += "/rules     : aturan memakai bot\n";
     welcome += "/led1on   : menyalakan led 1\n";
     welcome += "/led1off  : mematikan led 1\n";
     welcome += "/led2on   : menyalakan led 2\n";
     welcome += "/led2off  : mematikan led 2\n";
     welcome += "/status1  : cek status led 1\n";
     welcome += "/status2  : cek status led 2\n";
     welcome += "/allon     : menyalakan kedua led\n";
     welcome += "/alloff    : mematikan kedua led\n";
     bot.sendMessage(chat_id, welcome, "Markdown");
   }
   }
 }
void setup() {
 Serial.begin(115200);
 // Set WiFi to station mode and disconnect from an AP if it was Previously
 // connected
 WiFi.mode(WIFI_STA);
 WiFi.disconnect();
 delay(100);
 // attempt to connect to Wifi network:
 Serial.print("Connecting Wifi: ");
 Serial.println(ssid);
 Serial.println("ketikan nama bot anda pada telegram");
 WiFi.begin(ssid, password);
 while (WiFi.status() != WL_CONNECTED) {
   Serial.print(".");
   delay(500);
 }
 Serial.println("");
 Serial.println("WiFi terhubung");
 Serial.print("IP address: ");
 Serial.println(WiFi.localIP());
 Serial.println("ketikan nama bot anda pada telegram ");
 Serial.println("");
 pinMode(pir, INPUT);
 pinMode(ledPin1, OUTPUT); // initialize digital ledPin as an output.
 pinMode(ledPin2, OUTPUT);
 delay(10);
 digitalWrite(ledPin1, LOW); // initialize pin as off
 digitalWrite(ledPin2, LOW);
 myservo.attach(12);
 myservo.write(180);
}
void loop() {
 if (millis() > Bot_lasttime + Bot_mtbs)  {
   int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
   while(numNewMessages) {
     Serial.println("Pesan Diterima");
     Serial.println("sedang diproses.....");
     handleNewMessages(numNewMessages);
     numNewMessages = bot.getUpdates(bot.last_message_received + 1);
   }
   Bot_lasttime = millis();
 }
}
;>

3.配置電報機器人

4. 設(shè)置設(shè)備

?

?
pYYBAGOrz3uAbU7pAAFmBbmzSYM911.png
?

5. 測試

?

?

?

?


下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評論

查看更多

下載排行

本周

  1. 1NB-IoT芯片廠商的資料說明
  2. 0.31 MB   |  22次下載  |  1 積分
  3. 2智慧監(jiān)獄建設(shè)的核心終端—智慧監(jiān)倉屏
  4. 0.25 MB   |  2次下載  |  免費
  5. 3PC318C016M/D 200V半橋柵極驅(qū)動器技術(shù)手冊
  6. 0.77 MB   |  2次下載  |  免費
  7. 45.0SMDJ200A單向TVS瞬態(tài)抑制二極管規(guī)格書
  8. 0.88 MB   |  1次下載  |  免費
  9. 5PC318C041EQ 200V半橋柵極驅(qū)動器技術(shù)手冊
  10. 0.50 MB   |  次下載  |  免費
  11. 6PC318C042NM 200V半橋柵極驅(qū)動器技術(shù)手冊
  12. 0.55 MB   |  次下載  |  免費
  13. 7技嘉H110主板IT8628E_BX IO電路圖資料
  14. 2.61 MB   |  次下載  |  1 積分
  15. 8H110主板CPU PWM芯片ISL95858HRZ-T核心供電電路圖資料
  16. 0.63 MB   |  次下載  |  1 積分

本月

  1. 1元宇宙深度解析—未來的未來-風(fēng)口還是泡沫
  2. 6.40 MB  |  241次下載  |  免費
  3. 2元宇宙底層硬件系列報告
  4. 13.42 MB  |  184次下載  |  免費
  5. 32022 年展望報告 – 半導(dǎo)體產(chǎn)業(yè)
  6. 1.43 MB  |  136次下載  |  免費
  7. 4晶振與濾波器應(yīng)用電路《電子工程師必備:元器件應(yīng)用寶典》
  8. 1.57 MB  |  90次下載  |  免費
  9. 5汽車電子行業(yè)深度解析:智能化與電動化方興未艾
  10. 6.47 MB  |  71次下載  |  免費
  11. 6中國DPU行業(yè)白皮書
  12. 23.80 MB  |  37次下載  |  免費
  13. 7晶科鑫代理線-微盟電子2021年度產(chǎn)品目錄選型手冊
  14. 14.75 MB  |  27次下載  |  免費
  15. 8NB-IoT芯片廠商的資料說明
  16. 0.31 MB   |  22次下載  |  1 積分

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935137次下載  |  10 積分
  3. 2開源硬件-PMP21529.1-4 開關(guān)降壓/升壓雙向直流/直流轉(zhuǎn)換器 PCB layout 設(shè)計
  4. 1.48MB  |  420064次下載  |  10 積分
  5. 3Altium DXP2002下載入口
  6. 未知  |  233089次下載  |  10 積分
  7. 4電路仿真軟件multisim 10.0免費下載
  8. 340992  |  191425次下載  |  10 積分
  9. 5十天學(xué)會AVR單片機與C語言視頻教程 下載
  10. 158M  |  183352次下載  |  10 積分
  11. 6labview8.5下載
  12. 未知  |  81602次下載  |  10 積分
  13. 7Keil工具M(jìn)DK-Arm免費下載
  14. 0.02 MB  |  73822次下載  |  10 積分
  15. 8LabVIEW 8.6下載
  16. 未知  |  65991次下載  |  10 積分