Cov txheej txheem:

Kev Nyuaj Siab Zam Zam Kev Ua Si Nrog Qhov Tseeb Sensor: 5 Kauj Ruam
Kev Nyuaj Siab Zam Zam Kev Ua Si Nrog Qhov Tseeb Sensor: 5 Kauj Ruam

Video: Kev Nyuaj Siab Zam Zam Kev Ua Si Nrog Qhov Tseeb Sensor: 5 Kauj Ruam

Video: Kev Nyuaj Siab Zam Zam Kev Ua Si Nrog Qhov Tseeb Sensor: 5 Kauj Ruam
Video: VIM KEV KHWV NYIAJ [ab mem yang] nkauj tawm tshiab 2023 {MV} 2024, Hlis ntuj nqeg
Anonim

Los ntawm sa112Obniz lub vev xaib Ua raws ntau los ntawm tus sau:

Pub miv nyob deb siv Smartphone Nrog Obniz
Pub miv nyob deb siv Smartphone Nrog Obniz
Pub miv nyob deb siv Smartphone Nrog Obniz
Pub miv nyob deb siv Smartphone Nrog Obniz
Graphical Roulette Nrog Obniz
Graphical Roulette Nrog Obniz
Graphical Roulette Nrog Obniz
Graphical Roulette Nrog Obniz
JPEG Serial Camera Streaming Nrog Obniz
JPEG Serial Camera Streaming Nrog Obniz
JPEG Serial Camera Streaming Nrog Obniz
JPEG Serial Camera Streaming Nrog Obniz

Txog: DIY khoom siv hluav taws xob, javascript, IoT, obniz, programming, raspberrypi, arduino Ntau Txog sa112 »

Cov kev ua si uas muaj kev cuam tshuam zoo li Flappy Bird. Tsiv koj txhais tes kom tsis txhob muaj kev sib tsoo. Nws yog ib qho yooj yim ua thiab lom zem ua si!

Kauj Ruam 1: Yam Khoom Siv Hauv Txoj Haujlwm no

obniz

IR nrug deb sensor

Smartphone lossis computer

Kauj ruam 2: Teeb Obniz

Image
Image

Txhawm rau teeb tsa obniz, txhua yam koj yuav tsum tau ua yog ua raws peb qib.

  1. Txuas obniz rau wifi.
  2. Txuas cov cuab yeej zoo li LED lossis lub cav rau obniz.
  3. Luam theej duab QR code ntawm obniz thiab pib ua haujlwm. Koj tsis tas yuav nruab ib qho software.

Kauj ruam 3:

Txuas obniz thiab qhov deb nrug raws li hauv qab no.

  • io0: Teeb liab (daj)
  • io1: GND (dub)
  • io2: VCC (liab)

Kauj ruam 4:

Peb siv HTML5 canvas.

cia canvas = document.getElementById ('teb'); cia ctx = canvas.getContext ('2d');

Teeb tus nqi ntawm qhov ntsuas qhov deb mus rau qhov "inputHeight", thiab siv nws txhua lub sijhawm.

cia inputHeight = 0; cia obniz = Obniz tshiab ("OBNIZ_ID_HERE"); obniz.onconnect = async muaj nuj nqi () {cia sensor = obniz.wired ("GP2Y0A21YK0F", {vcc: 2, gnd: 1, teeb liab: 0}); sensor.start (muaj nuj nqi (qhov siab) {inputHeight = qhov siab;})};

{vcc: 2, gnd: 1, teeb liab: 0} yuav tsum raug hloov yog tias koj txuas cov cuab yeej sib txawv ntawm Kauj Ruam 2. Qhov nqi no yog siv raws li txhua tus ncej nkag

cia cov tswv yim = (300 - Qhov siab nkag); input = Math.min (Math.max (0, tawm tswv yim), canvas.height); dot.push (cov tswv yim);

Kauj Ruam 5: Txoj Haujlwm

Thov tau txais qhov program los ntawm no

Pom zoo: