Cov txheej txheem:

Talos, Ua Kom Koj Nyab Xeeb Thaum Koj Mus Ncig: 5 Kauj Ruam
Talos, Ua Kom Koj Nyab Xeeb Thaum Koj Mus Ncig: 5 Kauj Ruam

Video: Talos, Ua Kom Koj Nyab Xeeb Thaum Koj Mus Ncig: 5 Kauj Ruam

Video: Talos, Ua Kom Koj Nyab Xeeb Thaum Koj Mus Ncig: 5 Kauj Ruam
Video: Dab neeg Vauv tsis haum niam tais 2/6/2017 2024, Hlis ntuj nqeg
Anonim
Talos, Ua kom koj nyab xeeb thaum koj mus ncig
Talos, Ua kom koj nyab xeeb thaum koj mus ncig

Ua neeg raug tsim txom ntawm kev thab plaub thaum mus kev yog ib yam uas haum rau ntau tus neeg, tshwj xeeb yog poj niam. Xijpeem lub tebchaws, kev thauj mus los rau pej xeem feem ntau sib npaug kom paub tias koj tuaj yeem ua phem rau kev sib deev, lossis tseem ua raws thaum taug kev hauv tsev. Hauv cov xwm txheej no, nws tsis yooj yim los tawm tsam thiab ntsuas qhov kev hem thawj, los ntawm kev ntshai yooj yim los ntawm catcall mus rau qhov kev txhawj xeeb tiag tiag qee yam tsis zoo tuaj yeem tshwm sim. Kev ntshai ib txwm yog qhov tseem ceeb, thiab tsis xav hu lub peev xwm ua phem rau tus saib xyuas tuaj yeem tiv thaiv peb ntawm kev ceeb toom ib tus neeg uas peb ntseeg.

Talos yog lub cuab yeej me me uas txuas rau koj lub xov tooj thiab tso cai rau koj xa ntawv mus rau tus neeg uas koj xaiv. SMS tau suav nrog koj qhov chaw paub kawg thiab kab ntawv sau ua ntej ntawm koj xaiv. Nrog rau qhov pom ntawm cov keychain yooj yim, Talos nyob qis qis rau hauv koj lub hnab thiab tso cai rau koj ua kom pom tseeb los ntawm nias nws, uas ua rau xa cov ntawv xov xwm. Nws lub zog siv qis txhais tau tias koj tsis tas yuav them nws txhua hnub thiab pheej hmoo tsis nco nws - lossis tsuas yog ceeb toom txhua hnub ntawm kev hem thawj uas koj ntsib.

Muaj peb ntu rau txoj haujlwm no:

- Lub cev lub cev: Kuv siv Puck-js module, uas yog raws nRF52832 tus qauv thiab tuaj yeem tsim kho tau siv Javascript ua tsaug rau Espruino- Android app: Kuv tsim daim ntawv thov yooj yim uas txuas rau lub module- Keychain npog: Kuv ua qhov yooj yim npog rau Puck JS kom zoo li cov keychain yooj yim

Khoom siv

- Puck.js module (https://www.puck-js.com)

- Xov tooj Android nrog tsawg kawg version 8.0- Lub khoos phis tawj nrog Android Studio teeb tsa

- 3D tshuab luam ntawv (yeem)

Kauj ruam 1: Txheej txheem cej luam

Txheej txheem cej luam
Txheej txheem cej luam

Daim duab no yuav tsum muab tswv yim rau koj txog cov khoom sib txawv: cov cai ntawm Puck module nws tus kheej yog qhov yooj yim heev, thiab peb cia Android app saib xyuas kev sib txuas ntau dua li muaj Puck scan rau lub xov tooj. Peb yuav siv Bluetooth Tsawg Zog thiab nws cov yam ntxwv los sib txuas lus ntawm lub app thiab lub cuab yeej, txhawm rau khaws lub roj teeb lub neej

Kauj ruam 2: Programming lub Puck

Programming lub Puck
Programming lub Puck

Tom qab tau txheeb xyuas ntawm puck-js.com tias koj lub browser thiab khoos phis tawj txhawb nqa Web Bluetooth, mus rau www.espruino.com/ide thiab txuas rau koj lub Puck los ntawm txhaj rau lub cim ntsaws nyob rau sab saud sab laug ntawm nplooj ntawv.

Tom qab ntawd koj tuaj yeem luam tawm thiab muab cov cai los ntawm cov ntawv txuas rau hauv tus kho thiab xa mus rau Puck.

Hauv thawj feem ntawm txoj cai, peb tau txiav txim siab Blink thiab hloov kho tus yam ntxwv ua haujlwm, uas peb yuav siv tom qab hauv cov cai. Hauv kev hloov kho tshiab tus yam ntxwv, peb tab tom muab hnub tam sim no rau tus yam ntxwv kom paub tseeb tias nws yuav pom tseeb dua li tus nqi tshiab. Peb mam li ceeb toom ib tus neeg siv khoom ntawm qhov hloov tshiab no.

Tom qab cov lus tshaj tawm no, mus rau txoj cai uas yuav ua tiav:

Txoj cai ntawm kab 56 tso cai rau koj rov qab tau txais lub cev qhov chaw nyob ntawm koj lub Puck, uas koj yuav tsum tau hais kom raug hauv Android app: tsis ua raws kab no thiab koj yuav pom qhov chaw nyob ntawm cov cav ntawm sab laug tes ntawm IDE (saib txuas nrog) screenshot). Thaum koj muaj tus nqi no, koj tuaj yeem tawm tswv yim kab lossis tawm ntawm qhov ntawd.

Tom qab ntawd, peb tau txiav txim siab ib qho kev pabcuam BLE kev cai (UUIDs yog qhov txiaj ntsig tsis raug) nrog peb tus yam ntxwv sib txawv, txhua yam uas tsis tuaj yeem pom. Peb yuav tsis siv qhov txiaj ntsig lawv tus kheej los tshaj tawm peb cov lus tab sis tsuas yog qhov tseeb tias lawv tau hloov pauv.

Ntawm kab 78 thiab 79, peb teeb tsa qee tus neeg mloog uas yuav ua rau LED ntsais ntsais thaum twg lub cuab yeej txuas lossis txuas nrog los ntawm lwm lub cuab yeej Bluetooth. Thaum kawg, ntawm kab 81, peb tab tom cuam tshuam nrog khawm sib koom ua ke kom nias nws yuav hu rau qhov hloov tshiab

Kauj ruam 3: Tsim Android App

Tsim Android App
Tsim Android App
Tsim Android App
Tsim Android App
Tsim Android App
Tsim Android App
Tsim Android App
Tsim Android App

Txij li tag nrho app suav nrog qee lub tsev qiv ntawv hnyav, Kuv tau suav nrog cov ntaub ntawv nkaus xwb thiab cov ntaub ntawv gradle rau lub app sab hauv txuas nrog zip. Txhawm rau ua kom nws ua haujlwm, koj yuav tsum tso Android studio thiab tsim ib qhov haujlwm tshiab (xaiv Tsis Ua Haujlwm, saib cov duab). Xaiv 26 (Android 8.0, Oreo) raws li qhov tsawg kawg nkaus rau lub app raws li qee cov cai kuv tau sau siv APIs uas tsis muaj nyob ua ntej ntawd. Thaum koj qhov phiaj xwm tau teeb tsa, koj yuav muaj cov ntaub ntawv build.gradle rau App (cim build.gradle - Module: App). Qhib nws thiab luam cov ntsiab lus los ntawm cov ntawv zip: IDE yuav qhia koj kom ua Gradle sync thaum lub sijhawm nws yuav rub Nordic lub tsev qiv ntawv uas lub app tso siab rau. Koj tuaj yeem tso lub app ib zaug thiab tshawb xyuas tias nws ua haujlwm li cas.

Thaum lub app tau teeb tsa ntawm koj lub cuab yeej, mus rau koj cov ntawv qhia zaub mov, xaiv Apps, thiab nrhiav lub app hauv cov npe. Xaiv nws thiab nyem rau ntawm "Autorisations". Muaj, koj yuav muaj ob peb lub xov tooj cua khawm uas yuav raug tshem tawm los ntawm lub neej ntawd: txheeb xyuas lawv txhua tus kom ntseeg tau tias lub app tau nkag mus rau txhua yam nws xav tau.

Tam sim no koj tuaj yeem xa cov ntaub ntawv los ntawm zip archive: txoj hauv kev yooj yim tshaj plaws uas yog los tsim cov chav kawm tshiab (nyem txoj cai, tshiab Kotlin cov ntawv/chav kawm) thiab muab lawv lub npe zoo ib yam los ntawm cov ntawv khaws cia. Thaum cov ntaub ntawv hauv chav kawm tau qhib, koj tuaj yeem luam tawm thiab muab cov cai tso rau hauv lawv.

Yog tias koj tsuas yog xav siv lub app, tsuas yog hloov chaw nyob ntawm kab 31 ntawm chav BTService thiab sau qhov chaw nyob uas koj tau txais hauv cov kauj ruam dhau los. Tam sim no koj yuav tsum tuaj yeem suav sau lub app thiab khiav nws ntawm koj lub cuab yeej!

Yog tias koj xav paub ntau ntxiv txog qhov app ua haujlwm li cas, nyeem ntawm:-)

Cov duab hauv qab no yuav muab kev nkag siab zoo rau dab tsi tshwm sim hauv lub app: - MainActivity yog qhov uas tus neeg siv yuav tsuas siv ib ntus xwb: nws lub hom phiaj tseem ceeb yog kom lawv tuaj yeem nkag mus rau tus lej xov tooj ntawm tus neeg. lawv xav tiv tauj thaum siv Talos, nrog rau cov ntawv xa lawv.

- BTService yog qhov kev pabcuam ua ntej, uas txhais tau tias thaum twg nws tau pib, nws tsim cov ntawv ceeb toom tsis tu ncua uas txwv tsis pub muaj kev zoo li cov kev pabcuam raug tua los ntawm Android. Qhov kev pabcuam no sim txuas rau Talos siv cov txheej txheem Bluetooth Tsawg Lub Zog - Kuv tau siv Nordic tus qauv piv txwv thiab lwm yam peev txheej uas kuv tuaj yeem pom. Tam sim no, nws zoo li tshwj xeeb rau UUID ntawm Puck: koj yuav tsum hloov tus nqi no (tus kheej tus nqi remoteMacAddress = "CF: EB: 2F: 6E: 33: 30") kom phim koj lub cuab yeej tus kheej qhov chaw nyob tau ua hauv cov kauj ruam dhau los. Tom qab nrhiav lub cuab yeej thiab tshuaj xyuas tias nws puas muaj cov kev pabcuam peb tab tom nrhiav, nws ua npe rau cov ntawv ceeb toom rau tus yam ntxwv uas yuav hloov kho tshiab thaum twg tus neeg siv nias lub pob.

Thaum BTService tau txais qhov hloov tshiab rau tus yam ntxwv no, nws yuav tua ib qho khoom siv LocalBroadcast rau lwm qhov ntawm lub app kom hnov qab. Nws tseem yuav hu rau SMSIntentService rau nws kom xa SMS

- SMSIntentService yuav khaws tus lej xov tooj thiab ntawv los ntawm SharePreferences txhawm rau kom muaj tus lej kawg nkag los ntawm tus neeg siv. Tom qab ntawd nws yuav cia li xa SMS yam tsis muaj tus neeg siv cuam tshuam nrog lub app, thiab ntxiv tus neeg siv qhov chaw paub kawg rau SMS.

Kauj Ruam 4: Tsim Rooj plaub

Cov ntaub ntawv tam sim no uas Puck los nrog twb tau suav nrog lub voj me me rau nws kom txuas nrog tus yuam sij, yog li peb yuav luag tawm ntawm qhov ntawd. Txhua daim npog dawb silicon uas kuv tau tshwm sim los tseem xav tias zoo li txawv txawv thiaj li ua rau nws tsis ua rau muaj kev tsis ntseeg, kuv tsim cov khoom yooj yim los tso rau saum Puck. Lawv hais tias daim duab muaj nqis ib txhiab lo lus, kuv xav tias kuv yuav muab 25 daim duab rau koj thib ob: hauv cov vis dis aus hauv qab no, koj yuav pom tias kuv siv Fusion 360 los tsim qhov tsim, suav nrog cov lus txib thiab luv uas kuv siv:

Kauj Ruam 5: Muab Nws Txhua Qhov Ua Ke

Tam sim no koj muaj cov khoom sib txawv, nws yog lub sijhawm los muab tso ua ke! Qhov xwm txheej tam sim no ntawm Puck module twb muaj lub qhov uas koj tuaj yeem siv los ntxig ib txoj saw - Kuv tau tshwm sim kom muaj tus lej qub qub uas kuv tau muab sib nrug, tab sis koj tuaj yeem yuav cov uas yooj yim ib yam. Sib nrug lub nplhaib siv cov cuab yeej - ib zaug koj tau pom qhov qhib ntawm lub nplhaib, txav txhua ib nrab ntawm cov lus qhia rov qab, ib qho rau koj thiab lwm qhov nyob deb ntawm koj. Tom qab ntawd koj tuaj yeem ntxig lub nplhaib rau hauv Puck thiab kaw nws rov qab.

3D luam tawm tus qauv uas koj nyuam qhuav tsim - Kuv siv qee qhov PLA ntshav thiab ntsaws rau sab saum toj ntawm Puck

Pom zoo: