Your EasyEDA usage duration is brief. In order to avoid advertising information, this action is not supported at present. Please extend your EasyEDA usage duration and try again.
Editor Version×
recommended
Pro Edition
Brand new interactions and interfaces
Smooth support for design sizes of over 3W
devices or 10W pads
More rigorous design constraints, more
standardized processes
For enterprises, more professional users
Std Edition
Easy to use and quick to get started
The process supports design scales of 300
devices or 1000 pads
Supports simple circuit simulation
For students, teachers, creators
Ongoing
STD
RGB code with Arduino
RGB code with Arduino
Project tags
License
Public Domain
License: Public Domain
Mode:
Mode
Editors' pick
Editors' pick
1k
0
0
2
Update time:
2021-05-03 17:39:39
Creation time:
2019-01-14 15:16:20
Description
Description
Program:
#include
LiquidCrystal_I2C lcd(0x27, 16, 2);
int rosso = 11;
int verde = 10;
int blu = 9;
int pUno = 7;
int pDieci = 6;
int pCento = 5;
int pAvanti = 4;
int pOK = 3;
int pReset = 2;
int valUno = 0;
int valDieci = 0;
int valCento = 0;
int valAvanti = 0;
int valOK = 0;
int valReset = 0;
int colore = 0;
int valRosso = 0;
int valVerde = 0;
int valBlu = 0;
void setup() {
pinMode(rosso, OUTPUT);
pinMode(verde, OUTPUT);
pinMode(blu, OUTPUT);
pinMode(pUno, INPUT);
pinMode(pDieci, INPUT);
pinMode(pCento, INPUT);
pinMode(pAvanti, INPUT);
pinMode(pOK, INPUT);
pinMode(pReset, INPUT);
lcd.init();
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("R:");
lcd.setCursor(7, 0);
lcd.print("G:");
lcd.setCursor(0, 1);
lcd.print("B:");
}
void loop() {
valUno = digitalRead(pUno);
valDieci = digitalRead(pDieci);
valCento = digitalRead(pCento);
valAvanti = digitalRead(pAvanti);
valOK = digitalRead(pOK);
valReset = digitalRead(pReset);
if (valAvanti == 1) {
colore = colore + 1;
delay(300);
}
if (colore >= 3) {
colore = 0;
}
if (valRosso >= 256) {
valRosso = 0;
lcd.setCursor(3, 0);
lcd.print(" ");
}
if (valVerde >= 256) {
valVerde = 0;
lcd.setCursor(10, 0);
lcd.print(" ");
}
if (valBlu >= 256) {
valBlu = 0;
lcd.setCursor(3, 1);
lcd.print(" ");
}
if (colore == 0 and valUno == 1) {
valRosso = valRosso + 1;
delay(300);
}
if (colore == 0 and valDieci == 1) {
valRosso = valRosso + 10;
delay(300);
}
if (colore == 0 and valCento == 1) {
valRosso = valRosso + 100;
delay(300);
}
if (colore == 1 and valUno == 1) {
valVerde = valVerde + 1;
delay(300);
}
if (colore == 1 and valDieci == 1) {
valVerde = valVerde + 10;
delay(300);
}
if (colore == 1 and valCento == 1) {
valVerde = valVerde + 100;
delay(300);
}
if (colore == 2 and valUno == 1) {
valBlu = valBlu + 1;
delay(300);
}
if (colore == 2 and valDieci == 1) {
valBlu = valBlu + 10;
delay(300);
}
if (colore == 2 and valCento == 1) {
valBlu = valBlu + 100;
delay(300);
}
lcd.setCursor(3, 0);
lcd.print(valRosso);
lcd.setCursor(10, 0);
lcd.print(valVerde);
lcd.setCursor(3, 1);
lcd.print(valBlu);
if (valOK == 1) {
analogWrite(rosso, valRosso);
analogWrite(verde, valVerde);
analogWrite(blu, valBlu);
}
if (valReset == 1) {
digitalWrite(rosso, LOW);
digitalWrite(verde, LOW);
digitalWrite(blu, LOW);
valRosso = 0;
valVerde = 0;
valBlu = 0;
colore = 0;
lcd.setCursor(3, 0);
lcd.print(" ");
lcd.setCursor(10, 0);
lcd.print(" ");
lcd.setCursor(3, 1);
lcd.print(" ");
}
}
Forked project will be set private in personal workspace. Do you continue?
Clone
Project
The Pro editor is about to be opened to save as. Do you want to continue?
private message
Send message to sebastiancikes
Delete
Comment
Are you sure to delete the comment?
Report
RGB code with Arduino
No Profile
Announcer: SebastianCikes
Creation time: 2019-01-14 15:16:20
Published time:
2021-05-03 17:39:39
*
Report type:
Please select report type
*
Report reason:
Please fill in the reason for your report and the content is 2-1000
words
*
Upload image:
+
Upload image
*
Email address:
Please fill in your email address
Report
*
Report type:
Please select report type
*
Report reason:
Please fill in the reason for your report and the content is 2-1000
words
*
Upload image:
+
Upload image
*
Email address:
Please fill in your email address
Report
Submitted successfully! The review result can be viewed in the personal
center, review notification.
Kind tips
Your EasyEDA usage duration is brief. In order to avoid advertising information, this action is
not supported at present. Please extend your EasyEDA usage duration and try again.
Share
Project
Copy
Copy
Scan the QR code and open it on the mobile terminal