Pt-4: How To Program the 3-Color LED Module from the 37 in 1 Sensor Kit #arduino

preview_player
Показать описание
How to program the 3-Color LED Module from the KEYESTUDIO 37 in 1 Sensor Kit using the Arduino UNO, Arduino IDE. The diagram was made using Fritzing. #arduino #arduinouno #37in1sensorskit #keyestudio #3-color #rgb #led

Here's the Arduino code, remember to use PWM (~) pins:
Also, YT doesn't like angle brackets (aka 'less than' or 'greater than' symbols) in the comments section, so substitute 'lte' and 'gte' in code below with the 'less than equal to' and 'greater than equal to' symbols.
***************************************
int colorLEDPin;
int fadeSteps;

void setup() {
pinMode(colorLEDPin,OUTPUT);
}

void loop() {
for (colorLEDPin = 9; colorLEDPin 'lte' 11; colorLEDPin++){
for (fadeSteps = 0 ; fadeSteps 'lte' 255; fadeSteps++) {
analogWrite(colorLEDPin, fadeSteps);
delay(5);
}

for (fadeSteps = 255 ; fadeSteps 'gte' 0; fadeSteps--) {
analogWrite(colorLEDPin, fadeSteps);
delay(5);
}
}
}
***************************************
Рекомендации по теме
welcome to shbcf.ru