一区二区三区三上|欧美在线视频五区|国产午夜无码在线观看视频|亚洲国产裸体网站|无码成年人影视|亚洲AV亚洲AV|成人开心激情五月|欧美性爱内射视频|超碰人人干人人上|一区二区无码三区亚洲人区久久精品

電子發(fā)燒友App

硬聲App

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

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示
創(chuàng)作
電子發(fā)燒友網>電子資料下載>電子資料>使用電報機器人進行自動化開源

使用電報機器人進行自動化開源

2023-06-15 | zip | 0.00 MB | 次下載 | 免費

資料介紹

描述

嘿極客,希望你做得很好。在本文中,我們將制作一個非常有趣的項目,即使用電報機器人進行自動化。在這個項目中,我們將在電報機器人的幫助下控制三個 LED除了 LED,您還可以根據需要連接其他設備。您可以在我們的網站上閱讀全文。

?
poYBAGNocquARJJGAACmZ80zq9Y321.jpg
?

什么是電報機器人

在開始之前,請在您的智能手機上下載電報應用程序并在其上注冊一個帳戶。然后去搜索欄搜索botfather并打開帶有藍色勾號的帳戶。

?
pYYBAGNocq2AeRu7AAAPTj5k5go659.jpg
?

現在單擊開始啟動機器人,您會找到一個菜單。

?
pYYBAGNocrCAG-kFAAAPekV9Jrk964.jpg
?

然后單擊新機器人以創(chuàng)建一個新項目。

?
pYYBAGNocrOAIb5uAAAb9x9jvLk865.jpg
?

現在它會要求您提供一個合適的用戶名,然后為您想要制作的機器人提供一個唯一的名稱。對于用戶名,最后使用 _bot,如下所示。在此之后,您將獲得一個必須復制的唯一令牌 ID。然后將此ID粘貼到代碼中。然后打開你的機器人。

?
pYYBAGNocraAHBZYAAAfs6n2sTM339.jpg
?

打開類型 start 后,它會回復你的消息,如下圖所示。現在根據您的需要在應用程序上發(fā)送命令,例如開/關燈,LED 根據您的操作打開和關閉。請參閱下面給出的屏幕截圖。

?
poYBAGNocrmAXL_3AAAVemmTZc0169.jpg
?

當您鍵入RED LIGHT ON時,紅色 LED 將亮起,如下所示。

?
poYBAGNocruAYyCCAAC-057xWjs065.jpg
?

當您鍵入GREEN LIGHT ON時,綠色 LED 將亮起。

?
pYYBAGNocr6ATzPMAADAh1aL8UM137.jpg
?

如果您鍵入WHITE LIGHT ON ,白色 LED 將亮起。

?
pYYBAGNocsGAPylKAAC7sn-hsQM639.jpg
?

所需組件

  • NodeMCU esp8266
  • 三個不同顏色的 LED
  • 220歐姆電阻
  • 跳線和面包板
  • 用于上傳代碼的 USB 電纜

電報機器人自動化電路圖

pYYBAGNocsSAVvO5AACQXw5JA-M849.png
?

電報機器人代碼

注意:請將下面給出的代碼上傳到 NodeMCU。

//Techatronic.com
#include "CTBot.h"
CTBot myBot;
String ssid = "xxxxxxxxxxxx";   // REPLACE SSID WITH YOUR WIFI SSID
String pass = "xxxxxxxxxxxx"; // REPLACE Password YOUR WIFI PASSWORD, IF ANY
String token = "---------------------------------------------------";  // REPLACE Token WITH YOUR TELEGRAM BOT TOKEN
uint8_t greenled = 5;
uint8_t redled = 4;
uint8_t whiteled = 12;
void setup() {
// initialize the Serial
Serial.begin(115200);
Serial.println("Starting TelegramBot...");
// connect the ESP8266 to the desired access point
myBot.wifiConnect(ssid, pass);
// set the telegram bot token
myBot.setTelegramToken(token);
// check if all things are ok
if (myBot.testConnection())
Serial.println("\ntestConnection OK");
else
Serial.println("\ntestConnection NOK");
// set the pin connected to the LED to act as output pin
pinMode(redled, OUTPUT);
digitalWrite(redled, LOW);
pinMode(greenled, OUTPUT);
digitalWrite(greenled, LOW);
pinMode(whiteled, OUTPUT);
digitalWrite(whiteled, LOW);
}
void loop() {
// a variable to store telegram message data
TBMessage msg;
// if there is an incoming message...
if (myBot.getNewMessage(msg)) {
if (msg.text.equalsIgnoreCase("RED LIGHT ON")) {       // if the received message is "LIGHT ON"...
digitalWrite(redled, HIGH);                // turn on the LED
myBot.sendMessage(msg.sender.id, "RED Light is now ON"); // notify the sender
}
else if (msg.text.equalsIgnoreCase("RED LIGHT OFF")) {    // if the received message is "LIGHT OFF"...
digitalWrite(redled, LOW);               // turn off the led
myBot.sendMessage(msg.sender.id, "RED Light is now OFF"); // notify the sender
}
else if (msg.text.equalsIgnoreCase("GREEN LIGHT ON")){
digitalWrite(greenled, HIGH);                // turn on the LED
myBot.sendMessage(msg.sender.id, "GREEN Light is now ON"); // notify the sender
}
else if (msg.text.equalsIgnoreCase("GREEN LIGHT OFF")){
digitalWrite(greenled, LOW);               // turn off the led
myBot.sendMessage(msg.sender.id, "GREEN Light is now OFF"); // notify the sender
}
else if (msg.text.equalsIgnoreCase("White LIGHT ON")){
digitalWrite(whiteled, HIGH);                // turn on the LED
myBot.sendMessage(msg.sender.id, "WHITE Light is now ON"); // notify the sender
}
else if (msg.text.equalsIgnoreCase("WHITE LIGHT OFF")){
digitalWrite(whiteled, LOW);               // turn off the led
myBot.sendMessage(msg.sender.id, "WHITE Light is now OFF"); // notify the sender
}
else {                          // otherwise...
// generate the message for the sender
String reply;
reply = (String)"Welcome " + msg.sender.username + (String)". Try LIGHT ON or LIGHT OFF.";
myBot.sendMessage(msg.sender.id, reply);       // and send it
}
}
// wait 500 milliseconds
delay(500);
}

我們希望您喜歡這個項目。此外,請查看我們網站上有關 ArduinoRaspberry Pi的教程。

學習愉快!


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

評論

查看更多

下載排行

本周

  1. 1DD3118電路圖紙資料
  2. 0.08 MB   |  1次下載  |  免費
  3. 2AD庫封裝庫安裝教程
  4. 0.49 MB   |  1次下載  |  免費
  5. 3PC6206 300mA低功耗低壓差線性穩(wěn)壓器中文資料
  6. 1.12 MB   |  1次下載  |  免費
  7. 4網絡安全從業(yè)者入門指南
  8. 2.91 MB   |  1次下載  |  免費
  9. 5DS-CS3A P00-CN-V3
  10. 618.05 KB  |  1次下載  |  免費
  11. 6海川SM5701規(guī)格書
  12. 1.48 MB  |  次下載  |  免費
  13. 7H20PR5電磁爐IGBT功率管規(guī)格書
  14. 1.68 MB   |  次下載  |  1 積分
  15. 8IP防護等級說明
  16. 0.08 MB   |  次下載  |  免費

本月

  1. 1貼片三極管上的印字與真實名稱的對照表詳細說明
  2. 0.50 MB   |  103次下載  |  1 積分
  3. 2涂鴉各WiFi模塊原理圖加PCB封裝
  4. 11.75 MB   |  89次下載  |  1 積分
  5. 3錦銳科技CA51F2 SDK開發(fā)包
  6. 24.06 MB   |  43次下載  |  1 積分
  7. 4錦銳CA51F005 SDK開發(fā)包
  8. 19.47 MB   |  19次下載  |  1 積分
  9. 5PCB的EMC設計指南
  10. 2.47 MB   |  16次下載  |  1 積分
  11. 6HC05藍牙原理圖加PCB
  12. 15.76 MB   |  13次下載  |  1 積分
  13. 7802.11_Wireless_Networks
  14. 4.17 MB   |  12次下載  |  免費
  15. 8蘋果iphone 11電路原理圖
  16. 4.98 MB   |  6次下載  |  2 積分

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935127次下載  |  10 積分
  3. 2開源硬件-PMP21529.1-4 開關降壓/升壓雙向直流/直流轉換器 PCB layout 設計
  4. 1.48MB  |  420064次下載  |  10 積分
  5. 3Altium DXP2002下載入口
  6. 未知  |  233089次下載  |  10 積分
  7. 4電路仿真軟件multisim 10.0免費下載
  8. 340992  |  191390次下載  |  10 積分
  9. 5十天學會AVR單片機與C語言視頻教程 下載
  10. 158M  |  183342次下載  |  10 積分
  11. 6labview8.5下載
  12. 未知  |  81588次下載  |  10 積分
  13. 7Keil工具MDK-Arm免費下載
  14. 0.02 MB  |  73815次下載  |  10 積分
  15. 8LabVIEW 8.6下載
  16. 未知  |  65989次下載  |  10 積分