Closed arixank closed 3 years ago
@arixank Hello, The Ardunio code being procedural, the instructions are done one after the other, and as the loop function is the main function that "runs in loop", it executes the 2 instructions but so quickly that the brightness is not seen, it will be necessary to put a delay between the two or use the brigthness in the setup function and put a delay before switching to the loop function.
Examples :
#include <RGBLed.h>
RGBLed rgb(9, 10, 11, COMMON_CATHODE);
void setup() {}
void loop() {
rgb.brightness(RGBLed::CYAN, 5);
delay(1000);
rgb.flash(RGBLed::GREEN, 2500);
}
OR
#include <RGBLed.h>
RGBLed rgb(9, 10, 11, COMMON_CATHODE);
void setup() {
rgb.brightness(RGBLed::CYAN, 5);
delay(1000);
}
void loop() {
rgb.flash(RGBLed::GREEN, 2500);
}
Hoping to have helped you.
@wilmouths thanks earlier I had tried with setup one, but will try for the delay to and thanks I didn't knew it worked in that way! Will get back soon once it's working! Thank you?
Don't worry, tell me if the method I said works, but given the way arduino works it should work.
WELL IF I USE THE FUNCTION INDIVIDUALLY THEN IT WORKS, BUT WHEN COMBINED WITH OTHER FUNCTION LIKE FLASH, IT DOESN'T WORK AND SIMPLY IGNORES THE BRIGHTNESS AND USES FLASH ONLY!! AND I'M USING THEM IN LOOP SECTION SOMEWHAT LIKE THIS : led. brightness (code) ; led. flash(code); And I'm I doing It right??
I will attach an image too!