Cov txheej txheem:

RGB Lub Koob Yees Duab Backlight Tswj Nrog Android Txawb: 6 Cov Kauj Ruam
RGB Lub Koob Yees Duab Backlight Tswj Nrog Android Txawb: 6 Cov Kauj Ruam

Video: RGB Lub Koob Yees Duab Backlight Tswj Nrog Android Txawb: 6 Cov Kauj Ruam

Video: RGB Lub Koob Yees Duab Backlight Tswj Nrog Android Txawb: 6 Cov Kauj Ruam
Video: Sim Lub Koob Xoo Vivitar 1 Yees Duab thiab VDO "650-1300/2600 mm" 2024, Kaum ib hlis
Anonim
Image
Image
Sib xyaw Xim
Sib xyaw Xim

RGB Teeb Sib Piv Peb Lub Teeb LED Liab, Ntsuab & Xiav. Peb Kho Kho Lub Teeb Ntawm LED nws Tsim Xim Tshiab. Yog li LED Kho Kho Lub Teeb Pom Kev Siv Codes (0-255).

► Raws li cov LEDs nyob ze rau ib leeg, peb tsuas tuaj yeem pom cov xim kawg tshwm sim ntau dua li peb xim ib tus zuj zus. O Txhawm rau muaj lub tswv yim yuav ua li cas sib xyaw cov xim, ua tibzoo saib ntawm daim duab hauv qab no. Nov yog daim ntawv sib xyaw xim yooj yim tshaj plaws, muaj cov kab kos xim ntau dua nyob hauv lub vev xaib. GBRGB LEDs muaj 4 tus pin uas tuaj yeem sib txawv los ntawm lawv qhov ntev. Qhov ntev tshaj plaws yog av (-) lossis qhov hluav taws xob (+) nyob ntawm seb nws yog ib qho cathode lossis anode LED ntau, feem.

RGB LED yog kev sib xyaw ntawm 3 LEDs hauv ib pob xwb · 1x Liab LED

· 1x Ntsuab LED

· 1x Blue LED

Cov xim tsim los ntawm RGB LED yog ua ke ntawm cov xim ntawm txhua ntawm ib ntawm peb cov LEDs.

Kauj Ruam 1: Sib tov Xim

Txhawm rau tsim lwm cov xim, koj tuaj yeem ua ke peb xim hauv qhov sib txawv sib txawv. Txhawm rau tsim cov xim sib txawv koj tuaj yeem siv PWM los kho qhov ci ntawm txhua LED. Raws li cov LEDs nyob ze rau ib leeg, peb tsuas tuaj yeem pom cov xim kawg tshwm sim ntau dua li peb xim ib tus zuj zus.

R G B (255, 255, 255) = Dawb xim 255 yog qhov ci ntsa iab ntawm lub teeb ci

Kauj Ruam 2: RGB LED Ob Hom:

RGB LED Ob Hom
RGB LED Ob Hom

Kauj Ruam 3: RGB LED BLINK:

RGB LED BLINK
RGB LED BLINK

int redPin = 11; int greenPin = 10; int bluePin = 9; teeb tsa tsis muaj dab tsi () {pinMode (redPin, OUTPUT); tus pinMode (greenPin, OUTPUT); tus pinMode (bluePin, OUTPUT); } tsis muaj dab tsi voj () {setColor (255, 0, 0); // liab ncua (1000); setColor (0, 255, 0); // ntsuab ncua (1000); setColor (0, 0, 255); // xiav ncua (1000); setColor (255, 255, 0); // daj ncua (1000); setColor (80, 0, 80); // ntshav ncua (1000); setColor (0, 255, 255); // aqua ncua (1000); } void setColor (int liab, int ntsuab, int xiav) {#ifdef COMMON_ANODE liab = 255 - liab; ntsuab = 255 - ntsuab; xiav = 255 - xiav; #endif analogWrite (redPin, liab); analogWrite (greenPin, ntsuab); analogWrite (bluePin, xiav); }

Kauj Ruam 4: ARDUINO UNO Siv BLUETOOTH RGB CONTROLLER:

ARDUINO UNO siv BLUETOOTH RGB CONTROLLER
ARDUINO UNO siv BLUETOOTH RGB CONTROLLER

int xim = 0; int liab = 12; int ntsuab = 11; int xiav = 10;

char tau txais;

void teeb tsa () {

Serial.begin (9600); pinMode (liab, OUTPUT); pinMode (ntsuab, OUTPUT); pinMode (xiav, OUTPUT);

analogWrite (liab, 0);

analogWrite (ntsuab, 0); analogWrite (xiav, 0); }

void voj () {

yog (Serial.available ()> 0) {color = Serial.read (); char Rec = char (xim); yog (Rec! = '0') {Serial.println (Rec); }} // Dub yog tias (xim == 'B') {analogWrite (liab, 0); analogWrite (ntsuab, 0); analogWrite (xiav, 0); }

// DAWB

yog (xim == 'W') {analogWrite (liab, 255); analogWrite (ntsuab, 255); analogWrite (xiav, 255); }

// RED UA

yog (xim == 'R') {analogWrite (liab, 255); analogWrite (ntsuab, 0); analogWrite (xiav, 0); }

// LIAM

yog (xim == 'L') {analogWrite (liab, 0); analogWrite (ntsuab, 255); analogWrite (xiav, 0); }

// XAV

yog (xim == 'E') {analogWrite (liab, 0); analogWrite (ntsuab, 0); analogWrite (xiav, 255); }

// Daj

yog (xim == 'Y') {analogWrite (liab, 255); analogWrite (ntsuab, 255); analogWrite (xiav, 0); }

// Cyan/Aqua Cov

yog (xim == 'C') {analogWrite (liab, 0); analogWrite (ntsuab, 255); analogWrite (xiav, 255); }

// Magenta /Fuchsia

yog (xim == 'M') {analogWrite (liab, 255); analogWrite (ntsuab, 0); analogWrite (xiav, 255); }

// Moob

yog (xim == 'F') {analogWrite (liab, 128); analogWrite (ntsuab, 0); analogWrite (xiav, 0); }

// Txiv ntseej

yog (xim == 'O') {analogWrite (liab, 128); analogWrite (ntsuab, 128); analogWrite (xiav, 0); }

Ntsuab

yog (xim == 'G') {analogWrite (liab, 0); analogWrite (ntsuab, 128); analogWrite (xiav, 0); }

// Ntshav

yog (xim == 'P') {analogWrite (liab, 128); analogWrite (ntsuab, 0); analogWrite (xiav, 128); }

// Noob

yog (xim == 'N') {analogWrite (liab, 0); analogWrite (ntsuab, 0); analogWrite (xiav, 128); }

// lub teeb coral

yog (xim == 'J') {analogWrite (liab, 240); analogWrite (ntsuab, 128); analogWrite (xiav, 128); }

// txiv kab ntxwv liab

yog (xim == 'X') {analogWrite (liab, 255); analogWrite (ntsuab, 69); analogWrite (xiav, 0); }

// ntsuab daj

yog (xim == 'G') {analogWrite (liab, 173); analogWrite (ntsuab, 255); analogWrite (xiav, 47); }

// caij nplooj ntoos hlav ntsuab

yog (xim == 'S') {analogWrite (liab, 0); analogWrite (ntsuab, 255); analogWrite (xiav, 127); }

// dej hiav txwv

yog (xim == 'A') {analogWrite (liab, 127); analogWrite (ntsuab, 255); analogWrite (xiav, 212); }

// liab dawb

yog (xim == 'H') {analogWrite (liab, 255); analogWrite (ntsuab, 105); analogWrite (xiav, 180); }

// zib mu

yog (xim == 'D') {analogWrite (liab, 240); analogWrite (ntsuab, 255); analogWrite (xiav, 240); }

// lub teeb txho / lub teeb txho

yog (xim == 'U') {analogWrite (liab, 211); analogWrite (ntsuab, 211); analogWrite (xiav, 211); }}

Kauj Ruam 5: ARDUINO NANO Siv BLUETOOTH RGB CONTROLLER:

ARDUINO NANO Siv BLUETOOTH RGB CONTROLLER
ARDUINO NANO Siv BLUETOOTH RGB CONTROLLER

Kauj Ruam 6: DOWNLOAD: Arduino Code thiab Android App

Nyem Kuv

Pom zoo: