Cov txheej txheem:

Maze Game los Tswj Nrog Smartphone: 5 Kauj Ruam (nrog Duab)
Maze Game los Tswj Nrog Smartphone: 5 Kauj Ruam (nrog Duab)

Video: Maze Game los Tswj Nrog Smartphone: 5 Kauj Ruam (nrog Duab)

Video: Maze Game los Tswj Nrog Smartphone: 5 Kauj Ruam (nrog Duab)
Video: Temple Run™ But in Unreal Engine 5 2024, Hlis ntuj nqeg
Anonim
Image
Image

Maze game los tswj nrog lub xov tooj ntse

Lub maze txav raws qhov nqes hav ntawm lub xov tooj ntawm tes.

Ua ntej tshaj plaws, thov saib daim vis dis aus.

Tsab ntawv tsa suab

1. Raspberry Pi yog Websocket server.

2. Lub xov tooj smartphone yog Websocket tus thov kev pab.

3. Lub xov tooj smartphone xa cov ntaub ntawv qaij mus rau Raspberry Pi.

4. Raspberry Pi tswj cov servo raws li cov ntaub ntawv inclination.

Kauj Ruam 1: Kev Npaj Kho Vajtse

Kev Npaj Kho Vajtse
Kev Npaj Kho Vajtse
Kev Npaj Kho Vajtse
Kev Npaj Kho Vajtse
Kev Npaj Kho Vajtse
Kev Npaj Kho Vajtse
  • Servo thiab servo folderServo siv Tower-pro SG90. Thov xa mus rau qhov URL kom paub meej. Cov ntaub ntawv 3D kuj tseem tuaj yeem rub tawm.https://www.thingiverse.com/thing: 746116
  • Maze game (khoom siv lub teeb, ua nrog pawg thawj coj styrene)
  • Pob (Teeb khoom.)
  • Raspberry Pi (siv Raspberry Pi 3B)
  • Smartphones (Npaj browser tshiab kom ntau li ntau tau. Safari Chrome Firefox)

Kauj ruam 2: Kev sib txuas

Kev sib txuas
Kev sib txuas

1. Txuas kab sab saud mus rau GPIO 12 (32 PIN).

2. Txuas kab qis rau GPIO 18 (12 PIN).

3. Teem cov kev taw qhia ntawm servo.

Kauj Ruam 3: Teeb Raspberry Pi

Teeb tsa Raspberry Pi
Teeb tsa Raspberry Pi

1. PIB

Kev sib tham tau ua tiav nrog Rpi. GPIO teeb tsa hauv tus qauv, yog li ntawd, kuv yuav teeb tsa pi-gpiod. Qhov no yog vim tias PWM cov zis tau ruaj khov.

Txoj kev teeb tsa

sudo apt-tau nruab pigpio python-pigpio python3-pigpiohttps://abyz.me.uk/rpi/pigpio/index.html

Pib daemon.

sudo pigpiod

2. Node-RED

Nruab ib lub tsev qiv ntawv rau pi-gpiod.https://flows.nodered.org/node/node-red-node-pi-gpiod

Nruab lub tsev qiv ntawv dashboard rau debugging.https://flows.nodered.org/node/node-red-dashboard

3. Tsim kev ntws

Thov import (Luam & Muab tshuaj txhuam) cov ntawv hauv qab no rau Node-RED. Tso rau thaum koj tuaj yeem luam tau ib txwm.

Kauj ruam 4: Kev ua tiav

Tiav
Tiav
Tiav
Tiav

1. Txuas nrog lub xov tooj smartphone

Thov txuas koj lub smartphone rau WIFI ntawm tib ntu. Qhib lub vev xaib thiab nkag mus rau IP chaw nyob ntawm Raspberry Pi.

siv.

2. Tsiv lub maze raws txoj kab nqes hav ntawm lub smartphone. Cia peb ua kom qeeb.

Kauj Ruam 5: Txog Thaum Kawg

Raws li nws cuam tshuam txog kev txav ntawm lub xov tooj ntawm tes, thov kho qhov program thiab txo qis kev nkag siab.

Hauv qhov xwm txheej ntawd thov hloov kho qhov ua haujlwm ntawm Node-RED.

Zoo siab qhia

Pom zoo: