DFRobot DFR0274 Panduan Memulai Cepat - Halaman 3
Jelajahi secara online atau unduh pdf Panduan Memulai Cepat untuk Mikrokontroler DFRobot DFR0274. DFRobot DFR0274 12 halaman. Rgb led strip driver shield
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