Cov txheej txheem:

Arduino LED Ring Ultrasonic Distance Sensor: 8 Kauj Ruam
Arduino LED Ring Ultrasonic Distance Sensor: 8 Kauj Ruam

Video: Arduino LED Ring Ultrasonic Distance Sensor: 8 Kauj Ruam

Video: Arduino LED Ring Ultrasonic Distance Sensor: 8 Kauj Ruam
Video: How To Control a LED Strip with Ultrasonic Sensor 2024, Hlis ntuj nqeg
Anonim
Image
Image

Hauv qhov kev qhia no peb yuav kawm paub Yuav Siv Lub Teeb LED nrog thiab Ultrasonic module ntsuas qhov nrug li cas.

Saib daim vis dis aus.

Kauj ruam 1: Yam Koj Yuav Tsum Tau

Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
  • Arduino UNO (lossis lwm yam Arduino)
  • Ultrasonic Range Finder HC-SR04
  • Jumper xov hlau
  • Neopixel LED nplhaib
  • Visuino program: Rub tawm Visuino

Kauj ruam 2: Circuit Court

Qhov Circuit
Qhov Circuit
  • Txuas LED Ntiv Nplhaib [VCC] rau Arduino tus pin [+5V]
  • Txuas LED Ntiv Nplhaib [GND] rau Arduino tus pin [GND]
  • Txuas LED Ntiv Nplhaib [IN] lossis (DI) rau Arduino tus pin [6]
  • Txuas Ultrasonic module tus pin (VCC) rau Arduino tus pin [+5V]
  • Txuas Ultrasonic module tus pin (GND) rau Arduino tus pin [GND]
  • Txuas Ultrasonic module tus pin (ECHO) rau Arduino tus pin digital (3)
  • Txuas Ultrasonic module tus pin (TRIG) rau Arduino tus pin digital (2)

Kauj Ruam 3: Pib Visuino, thiab Xaiv Arduino UNO Board Type

Pib Visuino, thiab Xaiv Arduino UNO Board Type
Pib Visuino, thiab Xaiv Arduino UNO Board Type
Pib Visuino, thiab Xaiv Arduino UNO Board Type
Pib Visuino, thiab Xaiv Arduino UNO Board Type

Txhawm rau pib ua haujlwm rau Arduino, koj yuav tsum muaj Arduino IDE teeb tsa los ntawm no:

Thov nco ntsoov tias muaj qee qhov teeb meem tseem ceeb hauv Arduino IDE 1.6.6. Nco ntsoov tias koj nruab 1.6.7 lossis siab dua, txwv tsis pub Cov Lus Qhia no yuav tsis ua haujlwm! Yog tias koj tsis tau ua raws cov kauj ruam hauv Phau Ntawv Qhia no teeb tsa Arduino IDE rau program Arduino UNO! Visuino: https://www.visuino.eu tseem yuav tsum tau teeb tsa. Pib Visuino raws li pom hauv thawj daim duab Nyem rau ntawm "Cov cuab yeej" khawm ntawm Arduino tivthaiv (Daim Duab 1) hauv Visuino Thaum qhov kev sib tham tshwm, xaiv "Arduino UNO" raws li qhia hauv daim duab 2

Kauj Ruam 4: Hauv Visuino Ntxiv Cheebtsam

Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
  • Ntxiv "Ultrasonic Ranger (Ping)" tivthaiv
  • Ntxiv "NeoPixels" tivthaiv
  • Ntxiv "Ramp To Analog Value" tivthaiv
  • Ntxiv "Analog To Unsigned" tivthaiv
  • Ntxiv 2X "Sib piv Tus Nqi Analog" tivthaiv
  • Ntxiv 2X "Tus Nqi Xim" tivthaiv
  • Ntxiv "RGBW Xim Multi-Source Merger" tivthaiv

Kauj Ruam 5: Hauv Visuino Teeb Cov Khoom

Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
  • Xaiv "RampToValue1" thiab hauv cov khoom qhov rai teeb tsa "Nqes hav (S)" txog 1000
  • Xaiv "CompareValue1" thiab hauv cov khoom vaj huam sib luag teeb tsa "Sib piv Hom" rau ctBigger thiab "Tus nqi" rau 10-Xaiv qhov "Tus nqi" teb thiab Nyem rau ntawm tus lej pin thiab xaiv "Float SinkPin"
  • Xaiv "CompareValue2" thiab hauv cov khoom vaj huam sib luag teeb tsa "Sib Piv Hom" rau ctSmaller-Xaiv qhov "Tus Nqi" teb thiab Nyem rau ntawm tus pin tus cim thiab xaiv "Float SinkPin"
  • Xaiv "ColorValue1" thiab hauv cov khoom qhov rai teeb tsa "Tus nqi" rau clRed
  • Xaiv "ColorValue2" thiab hauv cov khoom qhov rai teeb tsa "Tus nqi" rau clLime
  • Ob npaug nias rau ntawm "NeoPixels1" thiab hauv "PixelGroups" qhov rai luag "Xim Pixel" mus rau sab laug Ntawm sab laug ntawm "PixelGroups" qhov rai ces xaiv "Xim Pixel1" thiab hauv cov khoom qhov rai teeb tsa "Suav Pixels" txog 12 lossis 16 (Nyob ntawm seb muaj pes tsawg LED koj lub nplhaib LED muaj) -Koj tuaj yeem hloov qhov ci ci LED yog tias koj xav tau los ntawm kev hloov tus nqi hauv "Brightness" teb

Kauj Ruam 6: Hauv Visuino Connect Components

Hauv Visuino Connect Components
Hauv Visuino Connect Components
  • Txuas "UltrasonicRanger1" tus pin [Ping (Trigger)] rau Arduino tus lej digital [2]
  • Txuas "Arduino" tus lej digital [3] Tawm mus rau "UltrasonicRanger1" tus pin [Echo]
  • Txuas "NeoPixels1" tus pin [Tawm] rau Arduino tus lej digital [6]
  • Txuas "UltrasonicRanger1" tus pin [Tawm] rau "RampToValue1" tus pin [Hauv] thiab "CompareValue1" tus pin [Tus Nqi] thiab "CompareValue2" tus pin [Tus nqi]
  • Txuas "RampToValue1" tus pin [Tawm] mus rau "AnalogToUnsigned1" tus pin [Hauv] thiab "CompareValue1" tus pin [Hauv] thiab "CompareValue2" tus pin [Hauv]
  • Txuas "CompareValue1" tus pin [Tawm] rau "ColorValue1" tus pin [moos]
  • Txuas "CompareValue2" tus pin [Tawm] rau "ColorValue2" tus pin [moos]
  • Txuas "ColorValue1" tus pin [Tawm] rau "RGBWColorMultiMerger1" Pin [0]
  • Txuas "ColorValue2" tus pin [Tawm] rau "RGBWColorMultiMerger1" Pin [1]
  • Txuas "RGBWColorMultiMerger1" tus pin [Tawm] rau "NeoPixels1"> Xim Pixel1 tus pin [Xim]
  • Txuas "AnalogToUnsigned1" rau "NeoPixels1"> Xim Pixel1 tus pin [U32 Index]

Kauj Ruam 7: Tsim, Ua Ke, thiab Tshaj Tawm Arduino Code

Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code

Hauv Visuino, Nias F9 lossis nyem rau ntawm lub pob uas qhia ntawm daim duab 1 los tsim Arduino code, thiab qhib Arduino IDE

Hauv Arduino IDE, nyem rau ntawm Upload khawm, txhawm rau sau thiab xa cov cai (Daim duab 2)

Kauj ruam 8: Ua si

Yog tias koj ua lub zog Arduino UNO tus qauv, lub nplhaib LED yuav tsum pib qhia qhov nrug deb, thiab yog tias koj ntxiv qhov teeb meem nyob rau hauv pem hauv ntej ntawm thaj tsam finder module lub nplhaib LED yuav tsum hloov nws cov xim.

Nrog koj zoo siab! Koj tau ua tiav koj txoj haujlwm nrog Visuino. Kuj txuas nrog yog Visuino project, uas kuv tau tsim rau Cov Lus Qhia no, koj tuaj yeem rub tawm nws ntawm no thiab qhib nws hauv Visuino:

Pom zoo: