Cov txheej txheem:

RGB LED Xim Tswj: 4 Kauj Ruam
RGB LED Xim Tswj: 4 Kauj Ruam

Video: RGB LED Xim Tswj: 4 Kauj Ruam

Video: RGB LED Xim Tswj: 4 Kauj Ruam
Video: Qhias kawm kho duab hauv photoshop pro cc 2017 zoo heev li nawb by VongLor 2024, Hlis ntuj nqeg
Anonim
RGB LED Xim Tswj
RGB LED Xim Tswj
RGB LED Xim Tswj
RGB LED Xim Tswj
RGB LED Xim Tswj
RGB LED Xim Tswj

Hauv txoj haujlwm no, peb yuav kawm paub tswj hwm qhov ci ci thiab xim ntawm RGB LED ntawm I/O cov chaw nres nkoj nrog PWM qhov peev xwm tso tawm, thiab kov cov khoom swb. 4Duino resistive touch zaub tau siv los ua lub ntsiab lus rau kev teeb duab sib tham los tswj kev siv thiab xim ntawm RGB LED.

RGB LEDs yog qhov tseem ceeb peb qhov sib txawv LEDs ua ke ua ib qho los tsim ntau yam ntxoov xim. Cov LEDs no muaj plaub ceg. Cov ceg ntev tshaj plaws yog ib qho anode lossis cathode, thiab lwm peb ceg txhais tau tias yog xim xim liab, ntsuab lossis xiav.

Txhawm rau tswj cov xim ntawm RGB LED peb yuav siv mem tes dav kev hloov pauv, lossis PWM kom luv. Pulse dav hloov pauv ua haujlwm los ntawm kev muab qhov pom ntawm "sib txawv sib piv qhov hluav taws xob" los ntawm kev hloov pauv feem pua ntawm lub sijhawm HIGH qhov hluav taws xob teeb liab yuav nyob hauv ib lub sijhawm nthwv dej.

Qhov qis dua lub luag haujlwm, lub sijhawm ntau lub teeb liab yuav siv ntawm LOW voltage lub xeev teeb liab thiab rov ua dua.

Kauj Ruam 1: YUAV UA LI CAS YUAV UA LI CAS

YUAV UA LI CAS
YUAV UA LI CAS

*Nov yog qhov RGB LED Xim Tswj Ua Haujlwm li cas.

Kauj Ruam 2: Tsim

Tsim
Tsim

QHOV TSEEB

  • 4 Dhau
  • RGB LED (ntau cathode siv hauv qhov piv txwv no)
  • 3 x 220Ω Resistor
  • Jumper kab
  • Micro USB kab

Tsim lub Circuit Court raws li daim duab thiab cov duab qhia saum toj no.

Txoj hauv kev uas siv PWM nyob ntawm seb hom RGB siv. Nrog ib qho anode RGB LED, cov ceg ntev txuas nrog cov khoom siv hluav taws xob tsheb nqaj hlau (hauv peb qhov xwm txheej 5V tus pin ntawm Arduino) thaum lwm tus peb ceg tau tswj los ntawm teeb tsa PWM teeb liab rau txhua tus. Yog tias lub luag haujlwm tseem ceeb ntawm PWM teeb liab siab, cov xim xim yuav tsaus heev lossis tsis qhib txhua. Yog vim li cas? Vim hais tias rau LED kom ci nws yuav tsum muaj lub peev xwm hluav taws xob hla nws, thiab yog tias peb lub PWM teeb liab muaj qhov feem pua siab rau lub luag haujlwm voj voog, nws yuav siv sijhawm feem ntau nws muaj 5V qhov muaj peev xwm ntawm ob qho tib si anode thiab xim xim ob txhais ceg thiab tsawg lub sijhawm nrog 5V ntawm anode thiab 0V ntawm cov xim xim.

Kauj ruam 3: PROGRAM

PROGRAM
PROGRAM

Rhiav 4 - 4Duino Basic Graphics ib puag ncig tau siv los tsim txoj haujlwm no.

Txoj haujlwm no xav kom Arduino IDE raug teeb tsa, raws li Rhiav hu rau Arduino IDE txhawm rau ua ke cov duab Arduino. Arduino IDE, txawm li cas los xij tsis tas yuav tsum tau qhib lossis hloov kho qhov program 4Duino.

  1. Rub tawm txoj haujlwm txoj cai ntawm no.
  2. Txuas 4Duino mus rau PC siv µUSB cable.
  3. Tom qab ntawv mus rau Comms tab thiab xaiv Comms chaw nres nkoj uas 4Duino txuas nrog.
  4. Thaum kawg, rov qab mus rau "Tsev" tab thiab tam sim no nyem rau ntawm "Comp'nLoad" khawm. Workshop 4 IDE yuav hais kom koj ntxig daim npav µSD mus rau lub PC txhawm rau txuag cov duab duab.

Kauj Ruam 4: DEMONSTRATION

DEMONSTRATION
DEMONSTRATION

Tam sim no siv cov kov swb ntawm 4Duino Display, koj tuaj yeem tswj xim ntawm RGB LED.

Pom zoo: