Cov txheej txheem:

Waiter Thov Bot: 6 Kauj Ruam (nrog Duab)
Waiter Thov Bot: 6 Kauj Ruam (nrog Duab)

Video: Waiter Thov Bot: 6 Kauj Ruam (nrog Duab)

Video: Waiter Thov Bot: 6 Kauj Ruam (nrog Duab)
Video: [HMONG w/Eng subs] Txhob Yuam Kev Hlub (Starring Pov Thoj) 2024, Kaum ib hlis
Anonim
Image
Image

Dab tsi tuaj yeem ua tsis raug nrog tus neeg tos xov tooj hu ntaus nrig los ntawm servo hauv qhov chaw ua haujlwm qhib?

- Kuv tsis paub: D

Tib neeg zoo li ntxub lub tswb lossis txawm tias cuam tshuam, yog li nws yog lub tswv yim zoo los ua kom nws lom zem me ntsis (ib ntus tsawg kawg). Qhov ntawd yog qhov kuv xav ua kom tiav. Tshaj tawm sai sai rau cov kws paub txog xwm txheej tseem ceeb hauv txoj kev lees paub.

Nws yog kuv thawj qhov haujlwm Arduino ua los ntawm Ethernet daim thaiv, Infra liab tswj, SG90 9g Micro Servo thiab cov khoom siv rov ua dua tshiab.

Qhov kev nqis tes ua los ntawm WebHook lossis kev tswj chaw taws teeb. Cov chaw taws teeb tswj kuj siv rau qhov zoo rau lub kaum sab xis ntawm caj npab.

Kauj Ruam 1: Nws Ua Haujlwm Li Cas?

Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?

Nws mloog ntawm infrared txais thiab nqa HTTP chaw nyob rau lo lus tseem ceeb. Cov tswj hluav taws xob tuaj yeem siv rau kev ua kom zoo ntawm lub kaum sab xis ntawm caj npab thiab tuaj yeem siv rau qhov ua kom zoo ib yam. HTTP Cov Lus Teb tuaj yeem siv tsuas yog ua rau lub tswb nrov. (Hauv qhov xwm txheej tam sim no kuv tau ua daim ntawv thov web me me uas ntes webhook los ntawm Slack thiab tswj tus chij. - Tsis suav nrog hauv cov lus qhia no)

Yeej kuv siv tus tswj hluav taws xob tsuas yog siv rau lub hom phiaj debug. Thawj zaug kuv tau ua yuam kev los ntawm tus tswj hwm nyob ib sab ntawm lub tshuab slap, tab sis cov neeg tau xav paub txaus kom ua rau npuaj ntau zaus yog li kuv pom lub cuab yeej txuas:)

Hauv lub neej tiag nws tsuas yog tshawb xyuas qhov nyuaj hauv web qhov chaw uas muaj cov lus teb zoo li:

Yog tias muaj lo lus tseem ceeb ua raws los ntawm ib tus lej ntau dua nws ua rau ntau lub caj npab txav mus.

Kauj Ruam 2: Yuav tsum muaj cov khoom siv

Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau

Cov khoom siv hluav taws xob:

  • Arduino Uno R3
  • UNO Shield Ethernet Shield W5100 R3
  • Infrared IR Wireless Remote-Control Module Kit
  • Servo tsav (SG90)
  • Universal Luam Ntawv Circuit Board 4x6cm
  • 5 x lwd
  • 5 x 220 Ohm Resistor
  • 30AWG Silicone Hlau

Cov khoom siv rov ua dua tshiab:

  • Tshuaj zawv plaub hau
  • Thawv thawv
  • Cov khoom ua si tes (tuaj nrog yuav ob lub croissant tau txais ib txhais tes dawb:)

Kauj Ruam 3: Ua ke nrog Arduino Tutorials

Feem ntau kuv tsuas yog ua raws Arduino Piv Txwv Piv Txwv, Cov Piv Txwv Hauv Tsev Qiv Ntawv thiab ua ke rau ib qhov haujlwm.

Cov lus qhia pom zoo

  • Blink yam tsis ncua - Siv rau LED ntsuas; millis () ua haujlwm los tshuaj xyuas HTTP ib ntus thiab tua servo yog tias tsis siv.
  • ASCIITable cov lej tso tawm ua haujlwm - Siv rau kev debugging.
  • Tswj Cov Qauv, zoo li: Loop Iteration, Hloov Case, Yog Nqe Lus, Thaum Loop
  • Ethernet Web Client nrog DHCP Lease - Siv kom tau txais qhov tshwm sim los ntawm HTTP qhov kawg.
  • Zaj lus qhia Servo - siv rau kev txav caj npab (kev sib hloov).
  • Infrared Txais - siv rau kev tswj hwm ntxiv thiab kho lub kaum sab xis ntawm caj npab.

Kauj Ruam 4: Tshawb nrhiav lo lus tseem ceeb hauv HTTP Cov Lus Teb thiab Lwm Yam Teeb Meem EthernetClient

Lub rooj sib tham ntawm Tus Neeg Tos Txais Thov Bot yog qhov ncaj ncaj rau pem hauv ntej tshwj tsis yog Ethernet yam.

Nyuaj

  1. Ib qho EthernetClient hu tshwj xeeb rau DHCP Lease yog txheej txheem nkaus xwb. Nws ua haujlwm zoo li ncua sijhawm nrog Rand dab tsi tso tseg txoj haujlwm.
  2. Tsis nco qab txog JSON hauv API thiab WebHook Arduino Strings yog qhov phem ib yam nkaus.

1. - Cov txheej txheem ib leeg

Kuv tso tseg kom ua txoj haujlwm ua ntau cov txheej txheem. Kuv google ob peb qhov kev daws teeb meem tab sis tsis yog lawv tau yooj yim. Kuv xav khaws cov cai me me thiab nyeem tau yooj yim li sai tau.

2. - Parse HTTP Teb.

Kev ruaj ntseg thiab tuaj yeem ua haujlwm yam tsis muaj kev saib xyuas yog qhov xav tau tseem ceeb. Yog li kuv zam kom tsis txhob siv cov khoom String vim muaj peev xwm nco tau.

EthernetClient tau tso siab rau kwj hauv paus chav kawm thiab nws txoj haujlwm nrhiav tau ua rau tshawb nrhiav lo lus tseem ceeb. Nws yog qhov nyuaj me ntsis thiab nyob ntau txoj kab ntawm cov cai, tab sis nws ua haujlwm.

Kauj Ruam 5: Sketch thiab Source

Sketch thiab Source
Sketch thiab Source

Cov chaw cia khoom:

Kauj Ruam 6: Tsim Kho Vajtse

Tsim Kho Vajtse
Tsim Kho Vajtse
Tsim Kho Vajtse
Tsim Kho Vajtse
Tsim Kho Vajtse
Tsim Kho Vajtse

Caj Npab

  1. Muaj plaub tus tiv thaiv kaum nyob hauv lub thawv xa khoom ntawm Macbook. Kuv siv nws li sawv ntsug.
  2. Txiav tawm cov duab me me haum rau servo.
  3. Kua nplaum ua ke sawv ntsug thiab servo nrog kub yaj kua nplaum phom.
  4. Nqa cov yeeb nkab los ntawm cov tshuaj zawv plaub hau uas tau siv thiab ntxig rau qhov servo.
  5. Rub tes cov khoom ua si ntawm cov yeeb nkab.

Tus Tswj

  1. Ua tus qauv ntawm daim ntawv qhia zaub mov.
  2. Luam theej tawm daim ntawv qhia zaub mov ntawv mus rau lub rooj tsav xwm luam tawm thoob ntiaj teb.
  3. Kuv siv tshem tawm cov headers rau txhua qhov kev sib txuas xov hlau.
  4. Txiav tawm lub thawv ntawv.
  5. Ua ke ua ke ntawm lub hauv ntej ntawm lub npov thiab lub rooj tsav xwm luam tawm.
  6. Muab Arduino board, Ethernet shield thiab qee daim txhuam cev rau hauv lub thawv.

Ua tiav

Pom zoo: