Cov txheej txheem:

ESP32 Raws Telegram Bot: 7 Kauj Ruam
ESP32 Raws Telegram Bot: 7 Kauj Ruam

Video: ESP32 Raws Telegram Bot: 7 Kauj Ruam

Video: ESP32 Raws Telegram Bot: 7 Kauj Ruam
Video: Подключение к ESP8266/ESP32 через бот Телеграм. Создание бота Telegram. 2024, Kaum ib hlis
Anonim
ESP32 Raws Telegram Bot
ESP32 Raws Telegram Bot
ESP32 Raws Telegram Bot
ESP32 Raws Telegram Bot

Telegram yog txhua yam hais txog kev ywj pheej thiab qhib-qhov chaw, nws tshaj tawm Telegram bot API tshiab hauv 2015, uas tau tso cai thib peb los tsim telegram bots rau ESP32 uas siv daim ntawv thov xa xov raws li lawv cov kev sib txuas lus tseem ceeb. Qhov no txhais tau tias peb tuaj yeem tswj hwm peb cov ntawv thov hauv tsev ntse thiab lwm yam khoom siv ntse nrog nws. Yog li, hauv kab lus no, peb yuav tham txog txoj hauv kev tshiab ntawm kev tswj hwm koj cov cuab yeej ntse thiab paub txog xwm txheej. Yog lawm, koj hais yog lawm, peb yuav tswj hwm lawv nrog social media app, "Telegram".

Telegram yog dab tsi? Telegram yog tus ntoo khaub lig-huab huab raws kev xa xov tam sim, vis dis aus thiab video VoIP kev pabcuam nrog qhov kawg-rau-kawg-encrypted tham rau kev sib tham tsis pub leej twg paub nkaus xwb, hos server-client / client-server encryption yog siv hauv huab tham.

Tab sis dab tsi txawv nws los ntawm lwm qhov kev xa xov sib tham yog lub peev xwm los tsim bots.

Telegram bots yog AI-based apps uas tuaj yeem teeb tsa los ua haujlwm ntau yam sib txawv, qee qhov piv txwv yuav zoo li, xa cov ntaub ntawv cuam tshuam txog huab cua lossis cov xov xwm muaj txiaj ntsig xov xwm, qee qhov tau npaj ua ntej kom xa lus ceeb toom, kuj tseem muaj qee qhov uas tuaj yeem ua nkauj lossis tsim cov npe ua, thiab ntau ntxiv.

Hnub no peb tseem yuav tsim ib qho bot uas yuav sib tham nrog peb ESP32.

Hauv qhov kev qhia no, peb yuav tswj hwm LED nrog Telegram bot, LED txuas nrog ESP32 pawg thawj coj. Hloov chaw ntawm LED, koj tuaj yeem tswj hwm tus pin txuas nrog rau lwm yam khoom siv lossis khoom siv.

Kauj Ruam 1: Yuav Tsum Tsim Kom Muaj ESP32 Raws Telegram Bot

Raws li txoj haujlwm no yog qhov haujlwm hnyav software, nws tsis xav tau cov cuab yeej ntau, tab sis muaj ob peb kauj ruam uas yuav tsum tau ua raws hauv software sab ntawm yam, peb yuav tham txog cov kauj ruam no thaum peb txav mus tom ntej hauv kab lus.

Yuav Tsum Tau Kho Vajtse:

ESP32 Pawg tswj hwm kev txhim kho

Yuav tsum tau Software:

Arduino IDE Cov

Cov Tsev Kawm Ntawv Tshwj Xeeb Arduino

Telegram App Cov

Kauj ruam 2: Ua Telegram Bot

Ua Telegram Bot
Ua Telegram Bot

Raws li peb tau tham ua ntej, Telegram tso cai rau peb los tsim ntau lub bots nrog kev ua haujlwm sib txawv. Rau peb txoj haujlwm, peb yuav tsim tus bot yooj yim siv Telegram. Tus so ntawm cov lus tshaj tawm thiab cov lus teb yuav raug sau rau hauv ESP pawg thawj coj nws tus kheej, uas yuav sib txuas lus rau peb tus bot siv kev sib tham ID. Peb yuav tham txog cov ntawd thaum peb mus txuas ntxiv hauv kab lus. Raws li qhov tawm ntawm txoj kev, peb tuaj yeem tig peb lub hom phiaj los tsim bot hauv Telegram.

Nruab Telegram los ntawm Play Store

Tom qab teeb tsa, ua tus as khauj yog tias koj tsis muaj ib qho lawm thiab ua raws cov kauj ruam tom ntej kom tau txais koj li TG bot ua haujlwm

Ua ntej, tshawb rau "botfather" thiab nyem rau ntawm BotFather raws li qhia hauv qab no. Lossis qhib qhov txuas no t.me/botfather ntawm koj lub smartphone

Botfather yog tus tsim ua ntej Telegram bot uas tso cai rau koj tsim, tswj hwm, thiab tshem tawm koj cov bots

Nyem rau ntawm lub pob pib thiab xaiv /newbot Muab koj lub npe bot thiab lub npe siv

Yog tias koj tus bot tau tsim tiav, koj yuav tau txais cov lus nrog qhov txuas rau nkag mus rau koj li bot tsim tshiab thiab bot token

Bot token yog tus cim tshwj xeeb uas peb yuav siv tom qab los tham nrog tus bot

Kauj Ruam 3: Tau Koj Tus Telegram Chat ID

Tau Koj Tus Telegram Chat ID
Tau Koj Tus Telegram Chat ID

Tus lej siv tus lej xov tooj yog tus lej tshwj xeeb rau txhua qhov kev sib tham, pab pawg, thiab cov neeg siv uas pab Telegram txheeb xyuas cov neeg siv thiab sib tham. Hauv qhov haujlwm no ntawm peb, leej twg nrog qhov txuas rau bot tuaj yeem cuam tshuam nrog bot. Txhawm rau tiv thaiv ib qho tsis tau tso cai nkag mus, peb tuaj yeem encrypt nws siv tus lej siv tshwj xeeb.

Los ntawm kev ua li ntawd, txhua lub sijhawm ESP tau txais cov lus los ntawm tus bot, nws tshuaj xyuas seb tus lej sib haum nrog tus lej khaws cia hauv nws thiab tom qab ntawd tsuas yog ua raws cov lus txib.

Cov kauj ruam kom tau txais koj li Telegram User ID:

Hauv koj tus lej Telegram, tshawb rau "IDBot" lossis qhib qhov txuas no t.me/myidbot ntawm koj lub xov tooj

Pib sib tham nrog tus bot ntawd thiab ntaus /getid. Koj yuav tau txais kev teb rov qab nrog koj tus lej ID

Nco tseg tus lej siv raws li peb yuav xav tau tom qab

Kauj Ruam 4: Txhim Kho Telegram Bot Library

Peb yuav siv Arduino IDE rau kev teeb tsa ESP32 pawg thawj coj. Yog li, xyuas kom tseeb tias koj muaj IDE ntxiv nrog rau pawg tswj hwm pob teeb tsa ntawm koj lub PC. Peb yuav tsum teeb tsa ob lub tsev qiv ntawv hauv Arduino IDE, siv cov tsev qiv ntawv no yuav ua rau txheej txheem coding yooj yim dua thiab yooj yim dua.

Txhawm rau tsim kev sib txuas lus nrog Telegram bot, peb yuav siv Universal Telegram Bot Library tsim los ntawm Brian Lough uas muab qhov yooj yim interface rau Telegram Bot API.

Ua raws cov theem tom ntej txhawm rau txhim kho qhov tseeb tso tawm ntawm lub tsev qiv ntawv

Nyem qhov txuas no txhawm rau rub tawm Universal Arduino Telegram Bot lub tsev qiv ntawv

Mus rau Sketch> suav nrog Tsev Qiv Ntawv> Ntxiv. ZIP Cov Tsev Qiv Ntawv …

Ntxiv lub tsev qiv ntawv koj nyuam qhuav rub tawm. Thiab qhov ntawd yog nws

Lub tsev qiv ntawv tau teeb tsa.

Yog xav paub ntxiv txog lub tsev qiv ntawv, koj tuaj yeem tshawb xyuas Universal Arduino Telegram Bot Library GitHub nplooj ntawv.

Tsev Kawm Ntawv ArduinoJson:

Koj kuj tseem yuav tsum nruab ArduinoJson lub tsev qiv ntawv. Ua raws cov kauj ruam tom ntej los teeb tsa lub tsev qiv ntawv.

Mus rau Sketch> suav nrog Tsev Qiv Ntawv> Tswj Tsev Qiv Ntawv

Tshawb nrhiav "ArduinoJson"

Xaiv qhov tseeb version muaj

Nruab lub tsev qiv ntawv

Raws li peb tau ua tiav txhim kho txhua lub tsev qiv ntawv xav tau peb tuaj yeem ua tau.

Kauj Ruam 5: Programming ESP32 Raws Telegram Bot

Programming ESP32 Raws Telegram Bot
Programming ESP32 Raws Telegram Bot

Peb yuav tsum nyem peb ESP32 hauv txoj hauv kev uas nws tau txais cov lus xa los ntawm tus bot, piv tus neeg siv tus lej, thiab tig lossis qhib LED raws li tau txais cov lus.

Hauv thawj qhov ntawm txoj cai, peb pib nrog ntshuam cov tsev qiv ntawv uas xav tau

Tom qab ntawd, peb pib ua qhov hloov pauv kom khaws SSID thiab Password ntawm koj li Wi-nkaus

Ib yam li ntawd, peb txhais cov kev hloov pauv rau tuav tus bot token thiab tham id. Koj yuav tsum muab koj daim ntawv pov thawj hauv cov kev hloov pauv no

Ntawm no koj tuaj yeem pom cov lej ua tiav nrog kev piav qhia.

Kauj Ruam 6:

Duab
Duab

Tam sim no peb tau ua tiav teeb tsa txhua yam. Tshaj tawm cov cai hais los saum no rau koj pawg ESP32 los ntawm Arduino IDE. Tsis txhob hnov qab xaiv lub rooj tsavxwm raug thiab chaw nres nkoj thaum rub tawm daim duab.

Tom qab rub tawm daim duab, nyem EN/Reset khawm ntawm lub rooj tsavxwm, kom nws pib ua raws txoj cai. Qhib tus lej saib, thiab tos rau lub rooj tsav xwm kom txuas nrog koj li Wi-nkaus router. Tam sim no, qhib Telegram thiab pib sib tham nrog koj tus bot los ntawm kev mus rau qhov txuas muab los ntawm Botfather thiab ntaus /pib.

Tam sim no koj tuaj yeem tswj hwm LED lossis paub lub xeev los ntawm kev ntaus cov lus txib sib xws.

Kauj Ruam 7: ESP32 Raws Telegram Bot - Ua haujlwm

Koj tseem tuaj yeem tshawb xyuas qhov vis dis aus uas qhia txog kev ua haujlwm ntawm qhov kev qhia no. Yog tias koj muaj lus nug, koj tuaj yeem tso lawv rau hauv kab lus hauv qab no.

Kuv vam tias koj nyiam tsab xov xwm thiab kawm qee yam muaj txiaj ntsig. Yog xav paub ntau cov lus qhia txaus siab, thov ua raws peb ntawm Instructables.

Pom zoo: