Cov txheej txheem:

Siv Bluetooth 4.0 HC -08 Module los Tswj Chaw Nyob LEDs - kev qhia Arduino Uno: 4 Cov Kauj Ruam (nrog Duab)
Siv Bluetooth 4.0 HC -08 Module los Tswj Chaw Nyob LEDs - kev qhia Arduino Uno: 4 Cov Kauj Ruam (nrog Duab)

Video: Siv Bluetooth 4.0 HC -08 Module los Tswj Chaw Nyob LEDs - kev qhia Arduino Uno: 4 Cov Kauj Ruam (nrog Duab)

Video: Siv Bluetooth 4.0 HC -08 Module los Tswj Chaw Nyob LEDs - kev qhia Arduino Uno: 4 Cov Kauj Ruam (nrog Duab)
Video: [아두이노강의] 포로리야 공대가자 #76 블루투스 모듈 HC06/2편 2024, Hlis ntuj nqeg
Anonim
Siv Bluetooth 4.0 HC -08 Module los Tswj Chaw Nyob LEDs - kev qhia Arduino Uno
Siv Bluetooth 4.0 HC -08 Module los Tswj Chaw Nyob LEDs - kev qhia Arduino Uno
Siv Bluetooth 4.0 HC -08 Module los Tswj Chaw Nyob LEDs - kev qhia Arduino Uno
Siv Bluetooth 4.0 HC -08 Module los Tswj Chaw Nyob LEDs - kev qhia Arduino Uno

Koj puas tau delved rau kev sib txuas lus modules tseem nrog Arduino? Bluetooth qhib lub ntiaj teb kev muaj peev xwm rau koj cov phiaj xwm Arduino thiab siv internet ntawm yam khoom. Ntawm no peb yuav pib nrog tus menyuam kauj ruam thiab kawm paub tswj hwm qhov chaw nyob LEDs nrog lub smartphone app siv HC08 Bluetooth module. Tom qab ntawv, koj yuav paub nrog lub xov tooj smartphone app koj tuaj yeem siv los tswj hwm lwm cov qauv nrog Bluetooth.

Dab tsi koj yuav xav tau rau qhov kev qhia no:

Kho vajtse:

-Arduino UAS

LED RING 16 X 5050 RGB WS2812

-Dupont cov xov hlau

-Txiv neej Headers

-HC-08 Bluetooth module

Software:

-Arduino IDE

-Piv txwv code

-NeoPixel Library

-Android thov tswj lub nplhaib (Kuv siv Serial Bluetooth Terminal rau qhov kev qhia no)

Cov Cuab Yeej:

-Soldering hlau

Cov txiaj ntsig ntawm kev siv BLE HC-08 tus qauv siv BLE (Bluetooth Tsawg Zog) raws tu qauv. Qhov sib txawv tseem ceeb ntawm Bluetooth thiab BLE yog kev siv hluav taws xob. Bluetooth siv lub zog ntau dua li BLE tab sis tuaj yeem lis ntau cov ntaub ntawv. BLE yog qhov tsim nyog rau kev xa cov ntaub ntawv me me ntawm cov cuab yeej nyob ze. BLE tsawg zog-tshaib plab, yog li cov cuab yeej siv cov txheej txheem no tuaj yeem ua haujlwm tau ntau xyoo nrog lub roj teeb me me; zoo meej rau IoT!

Kauj Ruam 1: Txuas Koj Cov Qauv

Txuas Koj Cov Qauv
Txuas Koj Cov Qauv

Nov yog yam koj xav tau txuas:

HC-08> Arduino Uno

TXD> RXD

RXD> TXD

GND> GND

3V3> 3V3

LED Ntiv Nplhaib> Arduino Uno

DIN> Pin 6

GND> GND

VCC> 5V

Kauj ruam 2: Teeb Koj Lub Software

  1. Rub tawm Arduino IDE yog tias koj tsis tau nyob ntawm www.arduino.cc/en/Main/Software)
  2. Nruab NeoPixel lub tsev qiv ntawv

    1. Rub tawm Adafruit NeoPixel Libraryas a.zip file (https://github.com/adafruit/Adafruit_NeoPixel)
    2. Hauv Arduino IDE, mus rau Sketch> suav nrog Tsev qiv ntawv> Ntxiv.zip tsev qiv ntawv
    3. Ntshuam Adafruit NeoPixel Library
    4. Xaiv cov ntawv uas koj nyuam qhuav rub tawm. Koj yuav tsum pom tias lub tsev qiv ntawv tau ntxiv ua tiav.
  3. Rub tawm daim ntawv thov Bluetooth ntawm koj lub smartphone. Koj tuaj yeem siv ntau daim ntawv thov Bluetooth los tswj hwm HC-08 tus qauv. Txawm li cas los xij, tsis yog txhua qhov sib xws nrog BLE raws tu qauv, yog li yog tias koj xav siv lwm lub app txheeb xyuas nws qhov sib xws ua ntej.

    Peb siv Serial Bluetooth Terminal rub tawm los ntawm Google Play Store

Kauj ruam 3: Upload Code

Rub tawm Txoj Cai
Rub tawm Txoj Cai
Rub tawm Txoj Cai
Rub tawm Txoj Cai

Txuas koj Arduino Uno rau lub khoos phis tawj thiab txheeb xyuas tias koj muaj lub rooj tsav xwm raug thiab qhov chaw nres nkoj xaiv nyob hauv Cov Cuab Yeej tab.

Rub qhov piv txwv no.

NCO TSEG: Thaum koj upload koj cov cai, tsis txhob txuas Arduino RX tus pin. Yog tias nws txuas nrog thaum rub tawm, cov cai yuav tsis ua haujlwm. Tom qab rub tawm koj yuav tsum txuas nws dua rau LED ua haujlwm.

Kev piav qhia txoj cai

Txoj cai tau teeb tsa rau hauv rooj plaub, ntxiv lossis tshem tawm ntau npaum li koj xav tau. Xaiv lawv nrog cov ntawv koj tuaj yeem nkag mus rau koj li Bluetooth app. Cov xwm txheej hauv peb cov cai raug cais nrog cov ntawv loj. Thaum koj ntaus rooj plaub rau hauv app, nws yuav hloov LED cov xim rau nws cov lej sib xws hauv IDE.

Piv txwv li, yog tias koj ntaus 'A' rau hauv koj lub app, koj lub LED yuav tsum hloov mus rau ntsuab (0, 255, 0)

Koj tuaj yeem hloov lub teeb ci LED los ntawm kev kho qhov RGB qhov tseem ceeb hauv kab lus. RGB tus nqi ntau ntawm 0 txog 255.

Yuav ua li cas-los kho tus kheej LED teeb

Koj tuaj yeem ua qhov no los ntawm kev luam cov cai uas tau hais tseg hauv cov thawv hauv daim duab saum toj no (cov cai no tshwm nyob ze rau hauv qab ntawm qhov piv txwv piv txwv) thiab hloov 'colorSet (strip. Color' …. Code hauv qhov xwm txheej nrog nws. 'I' yuav ua tus LED koj xav hloov. 'c' yuav yog tus lej xim. Koj yuav tsum tau ntxiv rov qab rau hauv strip. Color (rau hauv 'c' tus nqi qhov chaw nrog rau RGB code.

Piv txwv:

strip.setPixelColor (3, strip. Color (255, 127, 0));

Qhov no yuav tig qhov thib 3 LED rau cov xim txiv kab ntxwv.

Hauv qhov piv txwv tus lej no, peb tau muab cov piv txwv piv rau cov xim sib txawv LED rau ib tus neeg LEDs. Tam sim no koj tuaj yeem yooj yim hloov tus kheej LEDs.

Kauj ruam 4: Txuas rau Koj App thiab Khiav Cov Cai

Txuas rau Koj App thiab Khiav Cov Cai
Txuas rau Koj App thiab Khiav Cov Cai
Txuas rau Koj App thiab Khiav Cov Cai
Txuas rau Koj App thiab Khiav Cov Cai
Txuas rau Koj App thiab Khiav Cov Cai
Txuas rau Koj App thiab Khiav Cov Cai

Khiav cov cai! Nco ntsoov tias koj khaws RX kev sib txuas thaum rub tawm.

Tam sim no, qhib koj lub app thiab mus rau Bluetooth Devices kom pom koj tus qauv. Thaum txuas nrog, nyem rau ntawm lub cim sib txuas nyob ze lub thoob khib nyiab lub cim, thiab ntaus lub npe lub npe, hauv peb tus lej piv txwv, peb siv rooj plaub A-E, thiab saib lub teeb ci LED!

Tam sim no koj tau muaj kev paub siv daim ntawv thov Bluetooth thiab siv qhov chaw nyob RGB LED teeb, yog li koj tuaj yeem suav nrog ob qho no rau hauv koj cov phiaj xwm. Mus ntxiv thiab ua si nrog sijhawm thiab ncua kev ua haujlwm. Txaus siab rau!

Pom zoo: