Hello
I am a beginner in electronics and Arduino. is my first post here so if I make a mistake tell me to delete it.
I would like your help to make my homework for the electronics class of my school.
To say that I do not necessarily want the code for this, but a direction on how to do it.
Project:
Rgb led with color, master dimmer and strobe Potentiometer
So far I have managed to change the color of the led with three potentiometers one for each color, and display its values on a screen.
Now I would like to add two more potentiometers. A master dimmer where I will dimming the brightness of the led without changing the color. And one for the strobe, where the light will flash, when it is at zero the led will not flash and as it turns it will flash faster and faster
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,8,7,4,2);
const int ledRed=11;
const int ledGreen=10;
const int ledBlue=9;
const int potRed=A0;
const int potGreen=A1;
const int potBlue=A2;
const int potDimmer=A3;
const int potStrobe=A4;
int RVal,GVal,BVal;
int DVal,SVal;
void setup() {
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("RGB:");
pinMode(ledRed,OUTPUT);
pinMode(ledGreen,OUTPUT);
pinMode(ledBlue,OUTPUT);
pinMode(potRed,INPUT);
pinMode(potGreen,INPUT);
pinMode(potBlue,INPUT);
pinMode(potDimmer,INPUT);
pinMode(potStrobe,INPUT);
}
void loop() {
RVal=analogRead(potRed)/4;
GVal=analogRead(potGreen)/4;
BVal=analogRead(potBlue)/4;
DVal=analogRead(potDimmer)/4;
SVal=analogRead(potStrobe)/4;
lcd.setCursor(5,0);
lcd.print("R=");
lcd.print(RVal);
lcd.setCursor(11,0);
lcd.print("G=");
lcd.print(GVal);
lcd.setCursor(0,1);
lcd.print("B=");
lcd.print(BVal);
lcd.setCursor(6,1);
lcd.print("D=");
lcd.print(DVal);
lcd.setCursor(11,1);
lcd.print("S=");
lcd.print(SVal);
analogWrite(ledRed,analogRead(potRed)/4);
analogWrite(ledGreen,analogRead(potGreen)/4);
analogWrite(ledBlue,analogRead(potBlue)/4);
delay(50);
}
thanks for your time and i will be glad to see your comments