Full color RGB LED module use tutorial

(Suitable for Arduino, Micro: Bit and other common MCU)Copy the code

Overview of RGB module


I. Introduction of parameters

Two, the use of steps

1. Pin description

2. Connect the Arduino diagram

3.Arduino test program

int r=128;
int g=0;
int b=128; / / purple

void setup(a)
{
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(12,OUTPUT);
}
void loop(a)
{
  digitalWrite(12,HIGH);    / / 5 v power supply
  analogWrite(11, (255-r));
  analogWrite(10, (255-g));
  analogWrite(9, (255-b));
}
Copy the code

Experimental results: RGB light conversion

By: Qinhe Intelligent Technology