Cov txheej txheem:

Kev Sib Txuas Txuas Ntxiv (CRS) Lub Cev Muaj Zog Nrog Telegram Tswj: 8 Cov Kauj Ruam
Kev Sib Txuas Txuas Ntxiv (CRS) Lub Cev Muaj Zog Nrog Telegram Tswj: 8 Cov Kauj Ruam

Video: Kev Sib Txuas Txuas Ntxiv (CRS) Lub Cev Muaj Zog Nrog Telegram Tswj: 8 Cov Kauj Ruam

Video: Kev Sib Txuas Txuas Ntxiv (CRS) Lub Cev Muaj Zog Nrog Telegram Tswj: 8 Cov Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Hlis ntuj nqeg
Anonim
Kev Sib Txuas Txuas Txuas Ntxiv (CRS) Lub Cev Muaj Kev Tswj Telegram
Kev Sib Txuas Txuas Txuas Ntxiv (CRS) Lub Cev Muaj Kev Tswj Telegram

Hauv cov lus qhia no kuv yuav qhia koj paub tswj hwm CRS ntawm xov tooj. Rau qhov kev qhia no koj yuav xav tau ob peb yam. Kuv yuav ua haujlwm ntawm NodeMCU 1.0 (ESP-12E Module). Qhov no tuaj yeem ua haujlwm ntawm lwm daim ntawv Arduino, koj tsuas yog xav nrhiav lub zog tsim nyog rau nws.

Cov hauv qab no yog teeb tsa teeb tsa rau ESP-12E Module:

  • Windows 10
  • Arduino IE 1.8.7 (Windows Store 1.8.15.0)

Phau ntawv qhia yuav ua li cas rau nruab cov tsav tsheb thiab cov ntaub ntawv tseem ceeb rau ESP-12E Module tuaj yeem pom ntawm no:

Thaum koj tau ua qhov no. Peb npaj mus!

Kauj Ruam 1: Kauj Ruam 1: Cheeb Tsam

Kauj Ruam 1: Cheeb Tsam
Kauj Ruam 1: Cheeb Tsam

Rau qhov kev qhia no koj yuav xav tau qee yam khoom siv:

  • ESP12-E Module (ESP8266)
  • Kev Sib Hloov Nruam Servo Motor (qhov no yog qhov kuv siv)
  • Micro USB Cable
  • Ib qho Wifi Network
  • Telegram App Cov
  • Botfather Bot (tsis txhob txhawj, peb yuav mus txog ntawd)

Kauj Ruam 2: Kauj Ruam 2: Txuas Tus Tsav Tsheb

Kauj ruam 2: Txuas Servo Motor
Kauj ruam 2: Txuas Servo Motor

Ua raws cov lus qhia no kom xaim lub tshuab servo.

  • Dub: GND (Hauv av)
  • Liab: 3.3V lossis 5V (Fais Fab)
  • Daj lossis Dawb: Cov tso tawm digital (Teeb liab)

Yog li, yog tias koj siv tib lub cav servo uas kuv tau siv thiab muaj lub rooj tsav xwm arduino nrog qhov hluav taws xob siab dua (5V max) tso tawm, koj tuaj yeem lo lub hwj chim txuas rau ntawd. Nws yuav tsuas yog txhais tau tias servo motor yuav tsim ntau lub zog. Txawm li cas los xij, 3.3V lossis 5V yog ob qho zoo.

Kauj Ruam 3: Kauj Ruam 3: Kev Nkag Siab Me

Ua ntej peb pib ntsuas cov cai thiab pom tias nws ua haujlwm, muaj qee yam koj xav tau kom nkag siab txog lub tshuab servo no. Txij li nws tsis yog lub cav servo uas yooj yim, uas tig mus rau cov ces kaum tshwj xeeb, cov cai uas koj xav tau siv yog txawv me ntsis.

Kuv tsis pom zoo siv servo ntawm lub zog tag nrho, txij li nws tsim kom muaj cua sov ntau thiab tuaj yeem siv ntau lub neej uas cov khoom muaj. Sim nyob ib puag ncig thaj tsam ntawm [60, 120].

void voj {

myservo.write (90); // qhov no txhais tau tias tsis muaj kev txav mus los, servo motor tau sawv tseem ncua (1000); myservo.write (0); // qhov no txhais tau tias ua kom nrawm nrawm lub sij hawm rov qab txav qeeb (1000); myservo.write (180); // qhov no txhais tau tias ua kom nrawm nrawm raws lub sijhawm txav mus (1000); }

Kauj Ruam 4: Kauj Ruam 4: Ntxiv Txoj Cai los Xeem Servo Motor

#suav nrog

Servo tswj; teeb tsa tsis muaj dab tsi () {myservo.attach (D5); // txuas qhov servo ntawm tus pin D5)} void loop () {myservo.write (85); // tig lub cav rov qab rau lub sijhawm qeeb qeeb qeeb (1000); myservo.write (120); ncua (1000); myservo.write (90); ncua (5000); }

Kauj Ruam 5: Kauj Ruam 5: Npaj rau Kev Sib Txuas Lus

Yuav kom muaj peev xwm sib txuas lus nrog koj Arduino koj yuav tsum tau kho ob peb yam. Lawv yooj yim zoo nkauj. Peb yuav faib cov haujlwm no ua ob ntu me.

Tus bot

  1. Nruab Telegram ntawm koj lub xov tooj ntawm tes.
  2. Ua tus account hauv Telegram.
  3. Tshawb nrhiav tus neeg siv 'Botfather'.
  4. Ua tus bot tshiab siv cov lus txib nws qhia (khaws tus yuam sij nws muab rau koj).

Cov haujlwm Arduino

  1. Qhib Arduino IE.
  2. Mus rau 'Tus Thawj Saib Xyuas Tsev Qiv Ntawv'.
  3. Ntxiv lub tsev qiv ntawv 'Universal Telegrambot'.
  4. Ntxiv lub tsev qiv ntawv 'ArduinoJson'.

    • Tsis txhob ntxiv beta
    • Ntxiv qhov tseeb 5.x tsim muaj.

Kauj Ruam 6: Kauj Ruam 6: Xeem Kev Sib Txuas Lus

Kauj Ruam 6: Xeem Kev Sib Txuas Lus
Kauj Ruam 6: Xeem Kev Sib Txuas Lus

Peb nyob ze.

  1. Qhib 'echobot' tawm ntawm universaltelegrambot> esp8266 lub tsev qiv ntawv.
  2. Hloov daim ntawv pov thawj wifi kom phim koj lub network ntawm qhov chaw koj nyob.
  3. Hloov BOTtoken uas Botfather muab rau koj.
  4. Ntxiv cov kab no ntawm cov cai hauv lub voj uas nyob hauv lub voj void (); `

Serial.println (bot.messages .text);

Tam sim no peb tau npaj los sim.

Upload cov cai no rau koj Arduino. Txheeb xyuas hauv kab ntawv saib yog tias koj nyob ntawm NodeMCU txuas rau koj lub network wifi. Thaum koj pom tias nws tau txuas nrog, xa xov mus rau koj tus bot. Nws yuav tsum xa koj cov lus zoo ib yam rov qab rau koj.

Kauj Ruam 7: Kauj Ruam 7: Ntxiv Cov Lus txib

Yog li, nws ua haujlwm! Peb tau txais kev sib txuas ntawm cov khoom siv. Cov kauj ruam tom ntej yog ntxiv cov khoom ua ke. Yog li peb yuav ntxiv cov lus txib rau tus lej echobot uas twb muaj lawm. Tej zaum nws yuav yog lub tswv yim zoo los tso cov cai tom ntej no tsis yog tus lej kawg uas kuv tau muab rau koj. Yog li peb yuav tiv thaiv peb los ntawm kev muaj tus bot uas coj tus yam ntxwv zoo li tus parrot.

Daim ntawv txuas ntxiv no yuav tsum yog nyob rau hauv lub voj uas loops los ntawm cov lus tshiab. Depening ntawm yuav ua li cas koj tso servo motor koj yuav xav pauv qhov 'Qhib' thiab 'Kaw' cov lus txib. Tshaj tawm qhov no rau koj esp8266 thiab tshawb xyuas seb nws puas ua haujlwm.

// cov lus txib koj xav tau

yog (bot.messages .text == "Qhib") {

// Cov lus teb koj tus bot yuav muab rau koj bot.sendMessage (bot.messages .chat_id, "Kuv tab tom qhib daim ntaub thaiv rau koj.");

// dab tsi lub rooj tsav xwm arduino yuav ua

myservo.write (80); // servo lub cev muaj zog tig rov qab los qhib cov ntaub thaiv

}

yog (bot.messages .text == "Nres") {// Cov lus teb koj tus bot yuav muab rau koj bot.sendMessage (bot.messages .chat_id, "Nres cov ntaub thaiv."); // dab tsi arduino board yuav ua myservo.write (90); // servo motor nres tig

yog (bot.messages .text == "Kaw") {// Cov lus teb koj tus bot yuav muab rau koj bot.sendMessage (bot.messages .chat_id, "Kuv tab tom kaw kab hlau rhuav rau koj."); // dab tsi arduino board yuav ua myservo.write (80); // servo lub cev muaj zog tig raws lub moos kom kaw cov ntaub thaiv}

Kauj Ruam 8: Kauj Ruam 8: Txuas Tus Ntaus rau Koj Cov Kab Hlau (tsis tsim nyog)

Kauj Ruam 8: Txuas Tus Ntaus rau Koj Cov Kab Hlau (tsis tsim nyog)
Kauj Ruam 8: Txuas Tus Ntaus rau Koj Cov Kab Hlau (tsis tsim nyog)

Yeeeey, koj ua tiav!

Cov lus qhia tau hais txog yuav ua li cas txuas Telegrambot rau koj Arduino yog li koj tuaj yeem tswj hwm nws los ntawm qhov deb. Tab sis kuv tau ua qhov teeb tsa tshwj xeeb no kom muaj txoj hauv kev qhib kuv daim ntaub thaiv hauv kuv lub studio yam tsis tau qhib lub cev. Yog li yog tias koj xav ua tib yam li kuv, cov khoom kawg yog txuas peb lub cuab yeej me me rau koj daim ntaub thaiv thiab voila.

Pom zoo: