Upskill & Enhance Your Career... BE ON TOP WITH Robotronix!

DIY Learn & Purchase Kits

COding void loop() { // Set RGB LED to Red setColor(255, 0, 0); delay(1000); // Wait for 1 second // Set RGB LED to Green setColor(0, 255, 0); delay(1000); // Wait for 1 second // Set RGB LED to Blue setColor(0, 0, 255); delay(1000); // Wait for 1 second } // Function to set RGB LED color void setColor(int redValue, int greenValue, int blueValue) { // For common cathode type: Use analogWrite and invert the values analogWrite(redPin, 255 - redValue); analogWrite(greenPin, 255 - greenValue); analogWrite(bluePin, 255 - blueValue); // For common anode type: Uncomment the lines below and use analogWrite directly // analogWrite(redPin, redValue); // analogWrite(greenPin, greenValue); // analogWrite(bluePin, blueValue); }
COding void loop() { // Set RGB LED to Red setColor(255, 0, 0); delay(1000); // Wait for 1 second // Set RGB LED to Green setColor(0, 255, 0); delay(1000); // Wait for 1 second // Set RGB LED to Blue setColor(0, 0, 255); delay(1000); // Wait for 1 second } // Function to set RGB LED color void setColor(int redValue, int greenValue, int blueValue) { // For common cathode type: Use analogWrite and invert the values analogWrite(redPin, 255 - redValue); analogWrite(greenPin, 255 - greenValue); analogWrite(bluePin, 255 - blueValue); // For common anode type: Uncomment the lines below and use analogWrite directly // analogWrite(redPin, redValue); // analogWrite(greenPin, greenValue); // analogWrite(bluePin, blueValue); }

DIY Ideas

Videos From RobotroniX

COding

void loop()

{

// Set RGB LED to Red setColor(255, 0, 0);

delay(1000);

// Wait for 1 second

// Set RGB LED to Green setColor(0, 255, 0);

delay(1000);

// Wait for 1 second

// Set RGB LED to Blue setColor(0, 0, 255);

delay(1000);

// Wait for 1 second

}

// Function to set RGB LED color void setColor(int redValue, int greenValue, int blueValue)

{

// For common cathode type: Use analogWrite and invert the values analogWrite(redPin, 255 – redValue);

analogWrite(greenPin, 255 – greenValue);

analogWrite(bluePin, 255 – blueValue);

// For common anode type: Uncomment the lines below and use analogWrite directly

// analogWrite(redPin, redValue);

// analogWrite(greenPin, greenValue);

// analogWrite(bluePin, blueValue); }

Shopping cart

0
image/svg+xml

No products in the cart.

Continue Shopping