Cov txheej txheem:

Master Koj Micro: ntsis Nrog Arduino IDE-Khawm thiab Lwm Yam GPIO: 3 Cov Kauj Ruam (nrog Duab)
Master Koj Micro: ntsis Nrog Arduino IDE-Khawm thiab Lwm Yam GPIO: 3 Cov Kauj Ruam (nrog Duab)

Video: Master Koj Micro: ntsis Nrog Arduino IDE-Khawm thiab Lwm Yam GPIO: 3 Cov Kauj Ruam (nrog Duab)

Video: Master Koj Micro: ntsis Nrog Arduino IDE-Khawm thiab Lwm Yam GPIO: 3 Cov Kauj Ruam (nrog Duab)
Video: tinyML Summit 2021: Edge ML hardware for every application 2024, Hlis ntuj nqeg
Anonim
Master Koj Micro: ntsis Nrog Arduino IDE-Khawm thiab Lwm Yam GPIO
Master Koj Micro: ntsis Nrog Arduino IDE-Khawm thiab Lwm Yam GPIO

Hauv peb qhov blog yav dhau los Master Koj Micro: me ntsis nrog Arduino IDE -Teeb LED, peb tau tham txog yuav teeb tsa micro: me tsev qiv ntawv ntawm Arduino IDE thiab yuav ua li cas tsav LED ntawm micro: me ntsis nrog Arduino IDE. Hauv kab lus no, peb yuav qhia koj yuav ua li cas tsav micro: ntsis khawm thiab GPIO nrog Arduino IDE.

Kauj ruam 1: Khawm

Microbit muaj ob lub khawm nqa tus kheej ntawm lub rooj tsavxwm. Peb hu nws khawm A thiab khawm B cais. Tus lej IDE tus lej sib xws rau khawm A yog 5 thiab tus lej IDE tus lej sib txuas rau khawm B yog 11. Koj tuaj yeem pom daim duab qhia chaw rau khawm hauv qab no.

Los ntawm daim duab no, peb tuaj yeem pom tias lub pob tau txuas rau rub tawm tsam. Ua ntej lub pob nyem, nws nyob hauv qhov siab. Tom qab lub pob nyem, nws nyob hauv qhov hluav taws xob qis. Nov yog qhov piv txwv code rau lub pob:

[cceN_cpp ntsiab lus = "kaj ntug"] const int buttonA = 5; // tus lej ntawm tus lej khawm khawm const int khawm B = 11; // tus lej ntawm tus lej khawm tsis muaj dabtsis teeb tsa () {Serial.begin (9600); Serial.println ("microbit tau npaj txhij!"); pinMode (buttonA, INPUT); pinMode (khawm B, INPUT); } void loop () {yog (! digitalRead (buttonA)) {Serial.println ("Button A pressed"); } yog (! digitalRead (buttonB)) {Serial.println ("khawm B nias"); } ncua (10); }

[/cceN_cpp]

Tom qab koj rub tawm qhov program, teeb tsa tus nqi baud ntawm Serial Monitar kom yog 9600.

Nias khawm A, Serial Monitar yuav tso saib "Khawm A nias"; nias khawm B, nws yuav tso saib "khawm B nias".

Kauj Ruam 2: Lwm GPIO

Micro: ntsis coj tawm ib nrab IO chaw nres nkoj nrog nws cov ntiv tes kub. Peb yuav tsum tau them nyiaj tshwj xeeb rau qhov feem ntau ntawm IO chaw nres nkoj tuaj yeem siv dua. Txhawm rau siv IO cov chaw nres nkoj kom raug, koj tuaj yeem xa mus rau cov xwm txheej ntawm IO chaw nres nkoj rov siv dua. Yog xav paub ntxiv, koj tuaj yeem pom cov lus hauv qab no. Cov lus no qhia ntau yam ntaub ntawv hais txog txhua tus pin ntawm micro: ntsis ntug txuas.

Koj tuaj yeem siv tus kais dej coj los coj tawm P0, P1, P3, 3V thiab GND kom yooj yim. Yog tias nws tseem tsis txaus rau koj, Kuv xav qhia koj kom yuav lub micro: me ntsis tawg pawg thawj coj saib.

Ob qho saum toj no ob lub rooj sib cais tuaj yeem tawm tag nrho IO cov chaw nres nkoj, uas pab koj kom ua haujlwm rau IO cov chaw nres nkoj no thiab tswj cov txheej txheem sab nrauv.

Kauj Ruam 3: Nyeem txheeb ze:

Master Koj Micro: ntsis nrog Arduino IDE -Teeb LED

Kab lus no yog los ntawm:

Yog tias koj muaj lus nug, koj tuaj yeem tiv toj : [email protected].

Pom zoo: