DFRobot DFR0274 Quick Start Manual - Page 3

Browse online or download pdf Quick Start Manual for Microcontrollers DFRobot DFR0274. DFRobot DFR0274 12 pages. Rgb led strip driver shield

DFRobot DFR0274 Quick Start Manual
Sample Code
LED Strip driving code
Here's the basic code for controlling the color of the RGB LED strip.
int RedPin = 10;
int GreenPin = 11;
int BluePin = 9;
void setColor(int red, int green, int blue)
{
analogWrite(RedPin, red);
analogWrite(GreenPin, green);
analogWrite(BluePin, blue);
}
void setup()
{
pinMode(RedPin, OUTPUT);
pinMode(GreenPin, OUTPUT);
pinMode(BluePin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
for (int i=0;i<255;i++)
{
setColor(i, 0, 0);
delay (10);
}
delay(2000);
for (int i=0;i<255;i++)
{
Arrow.com.
Arrow.com.
Arrow.com.
Downloaded from
Downloaded from
Downloaded from
//Arduino driving pin for Red
//Arduino driving pin for Green
//Arduino driving pin for Blue
//Init Arduino driving pins
//Changing Red brightness
//Changing Green brightness