Cov txheej txheem:

Mais-tswj Mouse Siv Micro: ntsis: 5 Cov Kauj Ruam
Mais-tswj Mouse Siv Micro: ntsis: 5 Cov Kauj Ruam

Video: Mais-tswj Mouse Siv Micro: ntsis: 5 Cov Kauj Ruam

Video: Mais-tswj Mouse Siv Micro: ntsis: 5 Cov Kauj Ruam
Video: leej twg tej ntxhai - Mang Vang [ Official MV ] 2024, Hlis ntuj nqeg
Anonim
Mais-tswj Mouse Siv Micro: me ntsis
Mais-tswj Mouse Siv Micro: me ntsis
Mais-tswj Mouse Siv Micro: me ntsis
Mais-tswj Mouse Siv Micro: me ntsis
Mais taw-tswj Mouse Siv Micro: me ntsis
Mais taw-tswj Mouse Siv Micro: me ntsis

QHIA

Txoj haujlwm yog nas-tswj tus nas, nyob rau hauv daim ntawv ntawm lub hnab looj tes nrog micro: me ntsis kos hauv nws. Nws yog txoj haujlwm tau tshoov siab los ntawm lub tswv yim thaum ntxov uas kuv muaj ua tus kws kos duab. Kuv ib txwm xav kom nkag tau mus rau lub wireless nas thiab teeb tsa keyboard, rau kev cuam tshuam nrog ib qho microprocessor kuv yuav xav siv. Tus nas yog qhov tseem ceeb yog tias kuv tab tom khiav OS ntawm microprocessor. Muaj lub wireless nas thiab keyboard tau ua pov thawj los ua tus cawm seej ntau lub sijhawm, thiab hauv qhov no, Kuv txaus siab heev los tsim cov khoom siv thev naus laus zis uas tuaj yeem siv ua nas, thiab xav tau, cov keyboard.

Hauv cov lus qhia no, kuv yuav qhia cov kauj ruam thiab txheej txheem ntawm yuav ua li cas kuv siv lub micro: me ntsis nrog qee qhov Python code los ua lub hnab looj tes-ntsia tes taw-tswj nas.

Khoom siv

1 micro: ntsis nrog roj teeb

1 hnab looj tes rau txuas micro: ntsis rau

1 bluetooth-enabled computer Linux (Raspberry Pi siv ntawm no)

PC rau lub cajmeem micro: ntsis thiab qhib VNC ntu rau Raspberry Pi

Kauj Ruam 1: Nws Ua Haujlwm Li Cas

Image
Image

Kauj Ruam 2: Sib cuam tshuam Micro: ntsis rau Raspberry Pi Via Bluetooth

Interfacing Micro: ntsis rau Raspberry Pi Via Bluetooth
Interfacing Micro: ntsis rau Raspberry Pi Via Bluetooth

1. Thaum pib, kuv qhia ua ntu zus ntawm LED nyob rau hauv cov duab "b*", thiab pib ua ntej bluetooth accelerometer, khawm, LED thiab ntsuas kub.

2. Thaum muaj kev sib txuas ntawm bluetooth, lub vijtsam LED qhia pom "C", qhia tias micro: ntsis tau tsim kev sib txuas bluetooth.

3. Thaum muaj kev sib txuas ntawm bluetooth, lub vijtsam LED qhia pom "D", qhia tias lub micro: ntsis tau poob bluetooth txuas, thiab yuav xav rov txuas dua.

4. Hauv Project Settings, xaiv hom "No Pairing". Lub micro: ntsis lub vev xaib pom zoo "Tsuas Ua Haujlwm" ua ke, tab sis kev sib txuas ib txwm ua tsis tiav nrog tom kawg. Rau qee qhov laj thawj piav tsis tau, nws ua haujlwm nrog yav dhau los.

Kauj Ruam 3: Teeb Bluetooth ntawm Raspberry Pi

Teeb tsa Bluetooth ntawm Raspberry Pi
Teeb tsa Bluetooth ntawm Raspberry Pi
Teeb tsa Bluetooth ntawm Raspberry Pi
Teeb tsa Bluetooth ntawm Raspberry Pi
Teeb tsa Bluetooth ntawm Raspberry Pi
Teeb tsa Bluetooth ntawm Raspberry Pi

1. Nruab pob bluezero siv "sudo pip3 install bluezero"

2. Qhib bluetooth hais kom sai los ntawm kev ntaus "bluetoothctl". Cov lus qhia tshiab yuav tsum zoo li:

$ [bluetooth] #

3. Muab micro: ntsis rau hauv hom kev tshuaj xyuas los ntawm kev tuav khawm A thiab B, thiab nias lub pob pib dua. Tos kom txog thaum lub cim bluetooth tshwm ntawm lub vijtsam LED, tom qab ntawd tso tag nrho cov nyees khawm. Ntawm raspberry pi bluetooth davhlau ya nyob twg, ntaus "scan on". Thaum lub micro: me ntsis pom hauv cov npe ntawm cov cuab yeej tshiab, ntaus "scan tawm", thiab nco ntsoov ntaus ntawv chaw nyob ntawm micro: ntsis li "yy: yy: yy: yy: yy".

4. Pair thiab txuas nrog micro: ntsis los ntawm kev ntaus "khub yy: yy: yy: yy: yy: yy".

5. Txhawm rau txheeb xyuas tias kev sib koom ua haujlwm, ntaus "khoom siv" thiab kos yog micro: me ntsis tshwm hauv cov npe khoom siv. Yog tias kev sib txuas ua tiav, lub vijtsam LED ntawm lub micro: ntsis yuav tsum hloov mus rau "C". Yog tias tsis yog, rov pib dua micro: me ntsis thiab yooj yim sim ua khub dua ntawm bluetoothctl davhlau ya nyob twg ntawm Raspberry pi.

Kauj Ruam 4: Khiav Code ntawm Raspberry Pi

Khiav Code ntawm Raspberry Pi
Khiav Code ntawm Raspberry Pi

1. Khiav cov cai ntawm Raspberry Pi los ntawm kev ntaus "python3 mouse_control.py", uas txuas nrog qhov kawg ntawm cov kauj ruam no:

2. Cov lus ceeb toom yuav tsum tshwm ntawm lub davhlau ya nyob twg hais tias "Txuas". Nias ob lub khawm A thiab B rau ib pliag kom 'hloov ntawm' nas. Cov lus hais tam sim "Tsiv tus cursor ncig" yuav tsum tshwm tam sim no.

3. Txhawm rau 'tua' nas, rov nyem ob lub khawm ua ke. Cov lus teb ntawm "Mus txuas ntxiv lossis tawm?" tshwm. Ntaus c txhawm rau txuas ntxiv los ntawm theem 2, lossis tsuas yog nkag mus tawm ntawm txoj haujlwm.

4. Yog tias tus nas tuav nyob rau hauv txoj haujlwm thim rov qab (LED npo tig rov qab), cov haujlwm cuam tshuam qhov yuam kev nug tus neeg siv tuav tus nas kom raug, ua ntej mus rau kauj ruam 2.

5. Rau ib zaug nias, tuav tus nas mus rau hauv av (kom tus cursor nres txav) thiab nias lub pob A nkaus xwb. Rau ob npaug nyem, nias khawm B nkaus xwb.

6. Rau txoj cai taug kev, xa cov ntaub ntawv txuas nrog, uas yog cov lus pom zoo txaus.

7. Kev sib txuas ntawm bluetooth tsis tu ncua thiab tej zaum yuav tawg ntau heev, tshwj xeeb yog lwm yam khoom siv txuas nrog bluetooth tau siv nyob ze. Yog tias qhov no tshwm sim, khiav cov cai ntxiv yuav tsum ua haujlwm. Yog tias qhov ntawd tsis ua tiav, qhib lub bluetoothctl hais kom ua qhov rai thiab ua ke nrog micro: me ntsis ntxiv.

Kauj Ruam 5: Yav Tom Ntej Yav Tom Ntej

1. Cov nas tswj tau zoo tuaj yeem ua kom tau zoo. Yog tias siv qhov nrawm nrawm dua li siv txoj kab nrawm nrawm siv, nws yuav muab kev tswj hwm ntau dua.

2. Txij li kev sib txuas ntawm bluetooth tsis tu ncua, ib qho xwm txheej txhawm rau txheeb xyuas qhov tsis ua haujlwm txuas tuaj yeem ntxiv, uas yuav muaj cov lus teb ntawm rov tsim kev sib txuas ntawm txhua qhov ua tsis tiav.

3. Qee cov keyboard piav tes piav tes tuaj yeem ntxiv, zoo li kev npau taws tam sim tuaj yeem ua rau raug kaw, lossis piav tes piav taw ua ntej, thaum kuaj pom, tuaj yeem ua rau lwm qhov nquag siv hais kom ua/keyboard stroke.

Pom zoo: