Cov txheej txheem:

LED Sawb Brightness Controller: 4 Cov Kauj Ruam
LED Sawb Brightness Controller: 4 Cov Kauj Ruam

Video: LED Sawb Brightness Controller: 4 Cov Kauj Ruam

Video: LED Sawb Brightness Controller: 4 Cov Kauj Ruam
Video: Правила работы с микроскопом / Как настроить / Инструкция 2024, Kaum ib hlis
Anonim
LED Sawb Brightness Controller
LED Sawb Brightness Controller
LED Sawb Brightness Controller
LED Sawb Brightness Controller
LED Sawb Brightness Controller
LED Sawb Brightness Controller

LED Strips muaj npe thoob plaws lub ntiaj teb rau nws kev siv hluav taws xob qis thiab nws qhov ci ntsa iab. Qee lub sij hawm peb yuav tsum tau hloov kho qhov hluav taws xob thiab qhov ci ntawm cov kab ntawv LED no, piv txwv li, thaum koj tsaug zog koj yuav tau cuam tshuam vim qhov ci ntawm LED. Nov yog qhov haujlwm arduino los tswj qhov ci ntawm LED sawb. nws yog tus neeg siv -phooj ywg raws li nws tau txais qhov ci ci los ntawm tus neeg siv. Tus nqi ci ci yog nyob ntawm qhov hluav taws xob muab rau LED sawb. Yog tias tus neeg siv muab 5v, nws muab qhov ci tshaj plaws, yog tias tus neeg siv muab 0.1 volts nws muab qhov ci ci qis. Arduino tuaj yeem sau qhov hluav taws xob los ntawm 0 - 255 (0-5v cais piv txwv: 1v = 51 units). Tab sis siv cov lus txib thiab suav peb tuaj yeem txo qhov no mus rau 0-5v. Cia peb mus rau hauv qhov project.

Khoom siv

Yuav tsum:

  1. Arduino UNO / nano / MEGA
  2. LED sawb (Yuav tsum ua haujlwm tsawg kawg nkaus
  3. Arduino IDE Cov
  4. txuas xov hlau (nos 2)

Kauj ruam 1: Kev sib txuas

KEV NTSEEG
KEV NTSEEG

Nov yog cov kev sib txuas los txuas LED Sawb nrog Arduino:

ARDUINO LED Sawb

GND >> - (tsis zoo)

DIGITAL PWM 3 (pin3) >> + (positive)

--------------------------------------------------------------------------------------

txuas tus pin tsis zoo ntawm LED sawb rau groung (GND) tus pin ntawm arduino

txuas tus pin zoo ntawm LED sawb rau tus pin 3 tus pin ntawm arduino

Kauj ruam 2: CODE

CODE
CODE
CODE
CODE

Qhov tseem ceeb tshaj plaws tom ntej ntawm kho vajtse hauv Arduino yog txoj cai. Qhov chaws tau muab hauv qab no. Ntaus tus lej no thiab xa nws siv arduino IDE lossis bluino loader.

ntab ci ci; int LED = 3; ntab realbrightness; ntab ncua 1; ntab ncua 2; kev xaiv ntab; teeb tsa tsis muaj dab tsi () {pinMode (LED, OUTPUT); Serial.begin (9600); Serial.println ("Arduino LED strip controller"); Serial.println (""); Serial.println ("Thov sau qhov ci ci ntawm LED sawb (1-5)"); Serial.println (""); thaum (Serial.available () == 0) {} ci ntsa iab = Serial.parseFloat (); realbrightness = (ci ntsa iab) * 51.0; yog (realbrightness> = 6) {Serial.println ("Thov sau qhov pom kev ci"); }} void loop () {Serial.println (""); Serial.println ("LED sawb yog ntsais muag ntawm tus nqi"); Serial.print (ci ntsa iab); analogWrite (LED, qhov tseeb tiag); ncua (1000); }

Kauj Ruam 3: SIJ HAWM TEST

SIJ HAWM TEST!
SIJ HAWM TEST!
SIJ HAWM TEST!
SIJ HAWM TEST!

Txuas Arduino upload cov cai, qhib Serial monitor. Cov lus "Thov nkag mus rau qhov ci ci ntawm LED sawb (1-5)" yuav tsum tshwm. Enter tus nqi ci ntsa iab thiab nyem xa. koj tuaj yeem pom tias koj cov hlua LED tau khiav hauv koj qhov kev hais kom ua ci ntsa iab!.

Kauj Ruam 4: Cov ntaub ntawv ntxiv:

  • Qhov ci ntsa iab tuaj yeem nkag rau hauv tus lej zauv.
  • ci ntsa iab nkag mus saum 5, yuav zoo ib yam li 5.
  • Raws li tus nqi tau txais tsawg dua, qhov ci ci tau txo.
  • Los ntawm lub sijhawm qee zaum Arduino cov tsav tsheb yuav ploj hauv koj lub computer. Txhawm rau daws qhov tsis raug, qhib tus thawj tswj ntaus ntawv thiab hloov kho txhua tus tsav tsheb tsis paub.
  • Xaiv qhov tseeb COM chaw nres nkoj thiab version ntawm Arduino.
  • Code lwm download:

Pom zoo: