Skip to content

Instantly share code, notes, and snippets.

@gallaugher
Created June 25, 2018 00:27
Show Gist options
  • Select an option

  • Save gallaugher/80bdfdcfed100d422a7a5df0cbd41aa9 to your computer and use it in GitHub Desktop.

Select an option

Save gallaugher/80bdfdcfed100d422a7a5df0cbd41aa9 to your computer and use it in GitHub Desktop.
LBD 7 Part II
/*
RGBLedExample.ino
*/
#include <Easyuino.h> // Include the library in order to the compiler know you want Easyuino library
using Easyuino::RGBLed; // Necessary in order to use RGBLed
using Easyuino::Color; // Necessary for some method calls
int red_pin = 3; // Arduino pin connected to led red pin
int green_pin = 5; // Arduino pin connected to led green pin
int blue_pin = 6; // Arduino pin connected to led blue pin
RGBLed led(red_pin, green_pin, blue_pin); // Create the RGBLed object that exposes the API to use
void setup() {
led.begin(); // Called in setup method to initialize the RGBLed API
}
void loop() {
// RED
led.setColor(255, 0, 0);
delay(2000);
// "Real" Red
led.setColor(219, 103, 0);
delay(2000);
// GREEN
led.setColor(0, 255, 0);
delay(2000);
// "Real" Green
led.setColor(114, 226, 104);
delay(2000);
// BLUE
led.setColor(0, 0, 255);
delay(2000);
// "Real" Blue
led.setColor(114, 226, 104);
delay(2000);
/* This method call set the led to WHITE. */
led.setColor(255, 255, 255);
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment