Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Txuas Koj XBee
- Kauj Ruam 2: Xyuas kom tseeb PS tau teeb tsa rau 0 thiab AP tau teeb tsa rau 4
- Kauj Ruam 3: Qhib Tus Thawj Tswj Ntaub Ntawv
- Kauj Ruam 4: Kho Kho Kom raug COM Port
- Kauj Ruam 5: Qhib Kev Sib Txuas rau XBee
- Kauj Ruam 6: Rho Tawm Txoj Cai Laus hauv Tus Thawj Tswj Ntaub Ntawv
- Kauj Ruam 7: Hloov AP mus rau 1
- Kauj Ruam 8: Hloov mus rau Consoles Hom Ua Haujlwm thiab Qhib Kev Sib Txuas
- Kauj Ruam 9: Qhib Frames Generator
- Kauj Ruam 10: Kho lub Frames Generator los Tsim AT AT Command
- Kauj Ruam 11: Nkag mus rau AT Command kom Lwv Qhov Ua Haujlwm Nco
- Kauj Ruam 12: Ntxiv Cov Ncej
- Kauj Ruam 13: Xa AT Command
- Kauj Ruam 14: Txhais Cov Lus Teb
- Kauj Ruam 15: Hloov AP mus rau 4
- Kauj Ruam 16: Luag Koj Cov Cai Rau Hauv Tus Thawj Tswj Ntaub Ntawv
- Kauj Ruam 17: Qhib MicroPython Terminal
- Kauj Ruam 18: Kuaj Koj Li Cai
Video: Yuav Ua Li Cas Download MicroPython Code Rau XBee 3: 18 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
MicroPython yog hom lus tsim los ntawm Python 3.0 uas ua haujlwm ntawm microcontrollers, xws li XBee 3. MicroPython tuaj yeem pab txo qis cov khoom siv thiab kev ua haujlwm ntau ntawm koj txoj haujlwm, thiab ua kom yooj yim dua. Txawm li cas los xij, Kuv pom tias thaum kuv tab tom siv MicroPython, cov txheej txheem ntawm kev rub tawm thiab rub tawm cov cai rau hauv lub cuab yeej tau nkag siab yuam kev. Yog li cov lus qhia no lub hom phiaj piav qhia "txheej txheem" yooj yim ntawm yuav ua li cas rub tawm cov cai nkag mus thiab tawm ntawm koj XBee.
Yog tias koj tseem tsis tau, saib dhau Digi MicroPython Programming Guide. Nws tau txais txiaj ntsig kom tau txais kev paub dav dav ntawm MicroPython ua haujlwm li cas hauv XBees, thiab tseem rau kev daws teeb meem.
Cov ntawv qhia no tsis xav tias koj paub nrog XCTU, tab sis yog koj yog, koj tuaj yeem nyeem cov npe ntawm txhua ntu rau cov lus qhia yooj yim ntxiv yuav ua li cas rau nruab thiab tshem tawm MicroPython code. Nws xav tias koj twb tau sau koj cov cai thiab nws tau khaws tseg ua.py lossis.mpy cov ntaub ntawv.
XBee Kuv siv yog siv 802.15.4 raws tu qauv, yog li qhov sib txawv uas koj ntsib ntawm kev qhia thiab koj tus kheej ntawm XCTU tej zaum yuav yog vim qhov ntawd.
Qee txoj cai dav dav kom ua raws thaum siv MicroPython ntawm XBees:
- Khaws tus baud tus nqi ntawm 115200 lossis siab dua. Qhov no pab tiv thaiv kev poob ntawm cov ntaub ntawv.
- Ua kom koj cov cai dhau los ntawm cov pob khoom tuaj sai. Thaum siv MicroPython, XBee tsuas tuaj yeem tuav kab ntawm 4 pob ntawv cov ntaub ntawv-ib zaug kab ntawv puv, nws cuam tawm cov ntaub ntawv tshiab tuaj.
- Nco ntsoov tias koj XBee yog XBee3. MicroPython tsis ua haujlwm ntawm lwm tus qauv ntawm XBee.
Khoom siv
- XBee3 (ntau npaum li koj xav tau)
- XBee Explorer lossis zoo li dongle uas tso cai rau koj ntsaws koj XBee rau hauv koj lub computer
- Lub khoos phis tawj nrog XCTU teeb tsa rau nws
- A.py lossis.mpy cov ntaub ntawv uas muaj cov cai koj xav nruab rau ntawm XBee
Kauj ruam 1: Txuas Koj XBee
Plug rau hauv XBee koj xav ua haujlwm thiab qhib XCTU. Nyem rau Ntxiv Cov Khoom Siv (lub cim uas zoo li XBee nrog a + ntawm nws) nyob rau sab saud sab saud thiab xaiv qhov chaw nres nkoj COM raug. Xyuas kom tseeb tias Baud Tus Nqi raug (peb tawm ntawm XBees teeb tsa rau 9600), tom qab ntawv nyem Ua tiav txhawm rau txuas XBee.
XCTU siv sijhawm ntev los thauj khoom ntau yam. Thaum koj pom ntsuab loading bar, uas koj yuav nquag, cia li ua siab ntev.
Kauj Ruam 2: Xyuas kom tseeb PS tau teeb tsa rau 0 thiab AP tau teeb tsa rau 4
Nyem rau ntawm XBee lub cim ntawm sab laug ntawm lub vijtsam kom pom nws cov teeb tsa ntawm sab xis. Ntawm sab xis ntawm lub vijtsam, nqes mus rau ntu hu ua MicroPython Commands, thiab paub tseeb tias PS tau teeb tsa rau Xiam Oob Khab [0]. Yog tias nws tsis yog, hloov chaw thiab ntaus tus xaum cim lub cim nyob ib sab ntawm qhov chaw nyob ntawm sab xis kom sau qhov kev hloov pauv mus rau XBee. Ua tib yam hauv ntu hu ua UART Interface rau AP qhov ntsuas, thiab paub tseeb tias nws tau teeb tsa rau MicroPython REPL [4].
PS qhov ntsuas ntsuas txiav txim siab seb puas yog lossis tsis siv tus lej yuav siv thaum XBee qhib, thiab AP qhov ntsuas yog qhov "hom kev ua haujlwm" XBee nyob hauv. Txhawm rau kom MicroPython ua haujlwm, nws yuav tsum yog nws tus kheej "MicroPython hom. " Yog tias PS tau teeb tsa rau Enabled [1], nws tuaj yeem ua teeb meem nrog qee cov kauj ruam no, yog li kuv pom nws zoo tshaj plaws kom tua nws kom txog thaum kuv ua tiav hloov kho cov cai ntawm XBee.
Kauj Ruam 3: Qhib Tus Thawj Tswj Ntaub Ntawv
Nkag mus rau ntu "Cov Cuab Yeej" hauv kab ntawv nyob rau sab saum toj ntawm lub vijtsam thiab xaiv Tus Thawj Tswj Ntaub Ntawv. Nws qhib lub qhov rai uas zoo li ib qho uas tau hais los saum no-cov ntaub ntawv ntawm koj lub khoos phis tawj tau pom ntawm sab laug, thiab lub qhov rai khoob tau pom rau sab xis.
Kauj Ruam 4: Kho Kho Kom raug COM Port
Ntaus Configure. Xaiv qhov chaw nres nkoj COM raug, xyuas kom tseeb tias Baud Rate raug, thiab nyem OK. Koj yuav tsum pom lub npe ntawm qhov chaw nres nkoj COM xaiv hauv qhov chaw uas nws tau hais yav tas los "Kho qhov chaw nres nkoj ua ntej ua haujlwm nrog cov ntaub ntawv kaw lus."
Kauj Ruam 5: Qhib Kev Sib Txuas rau XBee
Ntaus Qhib. Yog tias koj tau txais qhov yuam kev, tshem tawm thiab ntsaws XBee rov qab los dua thiab tom qab ntawd Qhib feem ntau ua haujlwm. Tam sim no koj yuav tsum pom cov ntaub ntawv thauj mus rau XBee ntawm sab xis ntawm lub qhov rais. Yog tias koj XBee yog lub cim tshiab, koj yuav zaum tsuas pom ob daim ntawv, tab sis yog tias koj XBee tau siv ua ntej, koj yuav pom lwm cov ntaub ntawv hauv cov npe (ntawm kuv, muaj ib qho hu ua "main.py").
Kauj Ruam 6: Rho Tawm Txoj Cai Laus hauv Tus Thawj Tswj Ntaub Ntawv
Yog tias koj XBee tsis muaj tus lej qub rau nws, koj tuaj yeem hla cov kauj ruam no.
Yog tias koj tab tom hloov kho cov ntaub ntawv qub ntawm XBee, koj yuav tsum rho tawm qhov qub ua ntej. XBee tsis cia li rho tawm cov lej qub ntawm cov cai, thiab nws muaj qhov txwv tsawg heev, yog li koj yuav tsum rho tawm cov ntaub ntawv qub.
MicroPython code ntawm XBee yuav tsum yog nyob rau hauv cov ntaub ntawv npe “main.py” rau XBee kom cia li ua raws txoj cai. Koj tuaj yeem muaj ntau cov ntaub ntawv thauj mus rau XBee, tab sis tsuas yog ib qho nws yuav ua haujlwm thaum pib yog "main.py," yog li koj tuaj yeem siv ntau tus qauv tsuav yog koj import lawv mus rau "main.py." Yog tias koj siv ntau tus qauv, koj tsuas yog yuav tsum rho tawm qhov uas koj rov tso rau XBee.
Ua ntej, txoj nyem rau ntawm cov ntawv koj xav rho tawm, thiab xaiv Rho tawm. Tom qab ob peb feeb, nws yuav ploj ntawm Tus Thawj Tswj Ntaub Ntawv. Tam sim no cov ntaub ntawv raug tshem tawm ntawm lub ntsiab cia ntawm XBee. Txawm li cas los xij, XBee kuj tseem muaj lub cim xeeb ua haujlwm, qhov twg nws khaws cov cai kawg nws tau hais kom khiav, thiab qhov no yuav tsum tau muab tshem tawm ib yam nkaus. Ntaus Kaw hauv qab kaum sab xis kom tawm Tus Thawj Tswj Ntaub Ntawv.
Kauj Ruam 7: Hloov AP mus rau 1
Hauv XBee cov teeb tsa ntawm sab xis ntawm lub vijtsam, nqes mus rau ntu uas hais tias UART Interface. Hloov qhov AP ntsuas mus rau API Hom Tsis Muaj Escapes [1], thiab nyem lub cim mem hluav los sau nws rau XBee. Qhov no tso cai rau peb xa AT cov lus txib rau XBee, uas peb yuav tsum tau ua los lwv XBee lub cim xeeb ua haujlwm. Yog tias koj siv koj li XBee los ntawm qhov tshiab, tej zaum koj tsis tas yuav ua cov kauj ruam no thawj zaug koj rub tawm cov cai rau nws, tab sis nws tsis tuaj yeem ua kom paub tseeb tias lub cim xeeb ua haujlwm raug tshem tawm.
Kauj Ruam 8: Hloov mus rau Consoles Hom Ua Haujlwm thiab Qhib Kev Sib Txuas
Hloov mus rau Consoles Hom Ua Haujlwm los ntawm kev nias Alt-C lossis los ntawm khawm lub pob nyob rau sab xis saum toj uas zoo li TV saib, thiab nias Open kom qhib kab kev sib txuas lus rau koj XBee. Peb siv hom no los tham nrog peb XBees.
Kauj Ruam 9: Qhib Frames Generator
Ntawm sab xis ntawm lub vijtsam, hauv qab qhov uas nws hais tias Xa ib pob ntawv, nyem rau + icon, thiab tom qab ntawd nyem Tsim thav duab siv 'Frames Generator' cuab yeej hauv lub qhov rai qhib. Qhov no qhib Frames Generator, uas tau qhia saum toj no. Peb siv qhov no los tsim cov lus peb yuav xa mus rau XBee.
Kauj Ruam 10: Kho lub Frames Generator los Tsim AT AT Command
Qhov twg nws hais hom kab ntawv, nyem rau lub npov kom qhib cov ntawv qhia zaub mov nco thiab xaiv 0x08 - AT Command. Lub vijtsam yuav hloov mus rau hom ntawv uas tau hais los saum no.
Kauj Ruam 11: Nkag mus rau AT Command kom Lwv Qhov Ua Haujlwm Nco
Hauv lub npov xim liab uas hais tias AT hais kom ua, ntaus PY. Nov yog thawj feem ntawm AT cov lus txib, tseem ceeb qhia XBee peb xav ua qee yam nrog MicroPython. Hauv lub npov uas sau lo lus Parameter tus nqi, hom E. Nov yog qhov tshwj xeeb MicroPython hais kom peb xav kom XBee ua, uas yog lwv lub cim xeeb ua haujlwm ntawm XBee (Kuv sim nco "E rau Erase"). Raws li koj ntaus ntawv, cov lej yuav tshwm nyob rau hauv lub thawv hauv qab ntawm qhov screen.
Kauj Ruam 12: Ntxiv Cov Ncej
Ntaus OK. Tam sim no koj tau rov qab los ntawm lub qhov rais koj nyob ua ntej koj nkag mus rau Frames Generator. Lub thav duab lub npe tsis tshwj xeeb rau peb lub hom phiaj, yog li tsis quav ntsej nws. Koj yuav tsum pom cov lej los ntawm lub qhov rai kawg hauv lub npov ntawm lub qhov rais no. Yog tias yog, xaiv Ntxiv kab.
Kauj Ruam 13: Xa AT Command
Tus tshiab “thav duab_0” thav duab tshwm nyob rau hauv lub thawv ntawv sau xa ntas. Tam sim no peb tuaj yeem xa AT cov lus txib rau XBee. Xyuas kom tseeb tias cov kab uas peb nyuam qhuav ua tau hais txog, thiab tom qab ntawd nyem lub pob nrog lub xub ntsuab uas hais tias Xa cov kab ntawv xaiv. Cov ntawv xiav thiab liab yuav tshwm nyob rau hauv Frames cav saum toj no.
Kauj Ruam 14: Txhais Cov Lus Teb
Cov ntawv xiav yog cov lus txib koj nyuam qhuav xa, thiab cov ntawv liab yog XBee cov lus teb. Nyem rau kab ntawv liab kom nyeem nws. Koj tuaj yeem pom kab ntawm hexadecimal zoo ib yam li peb tau xa mus rau XBee hauv lub qhov rai sab xis. Koj tuaj yeem luam tawm thiab muab qhov no tso rau hauv Frames Tus Neeg Txhais Lus cuab yeej (nkag los ntawm nyem rau ntawm ib sab ntawm lub cuab yeej icon saum toj no), tab sis yog qhov thib ob rau zaum kawg ntawm tus lej yog ob npaug xoom, uas txhais tau tias nws ua tiav hauv kev tshem tawm kev ua haujlwm.
Kauj Ruam 15: Hloov AP mus rau 4
Nyem Kaw hauv lub ces kaum sab saud kom tawm kev sib tham nrog XBee.
Nyem rau lub cim iav kom rov qab mus rau XBee cov teeb tsa, thiab nqes rov qab mus rau UART Interface, thiab hloov AP qhov ntsuas rov qab rau MicroPython REPL [4]. Sau qhov chaw tshiab rau XBee los ntawm txhaj lub cim xaum.
Kauj Ruam 16: Luag Koj Cov Cai Rau Hauv Tus Thawj Tswj Ntaub Ntawv
Rov qab mus rau hauv Cov Cuab Yeej> Tus Thawj Tswj Cov Ntaub Ntawv, teeb tsa mus rau qhov chaw nres nkoj raug, thiab nyem Qhib. Ntawm sab laug ntawm lub qhov rais (koj lub khoos phis tawj lub computer cov ntaub ntawv), mus rau tus lej koj xav xa mus rau XBee, thiab nyem thiab rub nws mus rau sab xis (XBee cov ntaub ntawv). Koj yuav tsum pom cov ntawv tshwm ntawm sab xis. Tam sim no tus lej tshiab tau rub mus rau XBee.
Kauj Ruam 17: Qhib MicroPython Terminal
Ntaus Kaw. Nws yog lub sijhawm kom paub tseeb tias txoj cai ua haujlwm. Nkag mus rau Cov Cuab Yeej> MicroPython Terminal. Xaiv Configure, xaiv txoj cai COM chaw nres nkoj, thiab tom qab ntawd qhib Qhib. Yuav tsum muaj tus dub, ntsais tus cursor hauv lub qhov rais. Ntaus nkag mus, thiab koj yuav pom MicroPython hais kom sai: >>>
Kauj Ruam 18: Kuaj Koj Li Cai
Ntaus Ctrl-R, thiab cov cai hauv "main.py" cov ntaub ntawv yuav khiav. Yog tias txhua yam ua haujlwm raug, koj ua tiav! Yog tias koj xav kom cov cai siv tau thaum lub XBee qhib, kaw lub MicroPython Terminal, thiab hauv XBee cov chaw teeb tsa, nqes mus rau MicroPython Commands, thiab hloov PS PS parameter rau Enabled [1], thiab ntaus tus xaum cim kom sau mus rau XBee.
Pom zoo:
YUAV UA LI CAS YUAV UA LI CAS YUAV TSUM ROBOT COOB SCARECROW: 16 Cov Kauj Ruam (nrog Duab)
YUAV UA LI CAS YUAV TSUM NYOB ROBOT COW SCARECROW: Kuv nyuam qhuav tsim Moo-Bot, tus neeg hlau nyuj scarecrow dhia hla lub hli, rau kev sib tw hauv zej zog scarecrow.Kuv kev tshoov siab yog los ntawm kuv tus tub hu nkauj "hey diddle diddle, miv thiab fiddle. .. " Txoj haujlwm zoo heev los ua haujlwm nrog kuv
Yuav Ua Li Cas Thiaj Li Tshem Tawm Lub Computer Nrog Cov Kauj Ruam Yooj Yim thiab Duab: 13 Kauj Ruam (nrog Duab)
Yuav Tsum Tshem Tawm Lub Khoos Phis Tawj Li Cas Nrog Cov Kauj Ruam Yooj Yim thiab Duab: Nov yog cov lus qhia txog yuav ua li cas tshem lub PC. Feem ntau ntawm cov khoom siv yooj yim yog hloov pauv thiab tshem tawm tau yooj yim. Txawm li cas los xij nws yog ib qho tseem ceeb uas koj tau koom nrog nws. Qhov no yuav pab tiv thaiv koj kom tsis txhob poob ib feem, thiab tseem ua rau kev rov ua dua tshiab
Yuav Ua Li Cas Bluetooth Shields rau Upload Sketch rau Arduino: 9 Cov Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Bluetooth Shields Rau Upload Sketch rau Arduino: Koj tuaj yeem tso daim duab kos rau Arduino los ntawm hauv xov tooj ntawd lossis pc dhau bluetooth, ua nws koj xav tau qee qhov ntxiv me me xws li bluetooth module, capacitor, resistor, beardboard thiab jumper xov ces koj nqes ua ke thiab txuas rau Arduino tus pin
Yuav Ua Li Cas Thiaj Li Sib Koom Cov Yees Duab thiab Cov Ntaub Ntawv Network Los Ntawm Ethernet Cable: 6 Cov Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Thiaj Li Ua Ke Cov Yees Duab thiab Network Cov Ntaub Ntawv Los ntawm Ethernet Cable: Kuv xav tau los khiav Video thiab Suab mus rau lwm qhov ntawm kuv lub tsev. Teeb meem yog, Kuv tsis muaj AV cable ntau, tsis yog lub sijhawm thiab nyiaj txiag los teeb tsa zoo. Txawm li cas los xij kuv tau muaj Cat 5 Ethernet Cable ntau nyob ib puag ncig. Nov yog qhov kuv tuaj nrog
Yuav Hloov Li Cas IKEA Vase Rau Hauv Chaw Them Nqi Rau Koj Cov Khoom Siv.: 4 Cov Kauj Ruam (nrog Duab)
Yuav Hloov Li Cas IKEA Vase Rau Hauv Chaw Them Nqi Rau Koj Cov Khoom Siv.: &Hellip; lub tswv yim yooj yim nrog txoj kev yooj yim dua … ~ Zaj dab neeg ~ Kuv nyob hauv chav me me thiab kuv muaj ob peb lub cuab yeej me me uas yog lub zog-siab hlob. Kuv tau sim yav dhau los txhawm rau txhawm rau qee qhov chaw nyob ze ntawm phab ntsa ntsaws, kom them lawv txhua