Arduino | Control LED brightness with potentiometer | Fade (with code e schematic)

preview_player
Показать описание
I this video i will do a tutorial of a project. It allows you to control the brightness of a LED using a potentiometer or a trimmer.
Рекомендации по теме
Комментарии
Автор

int LED=11;
int pot=0;


void setup(){

pinMode(LED, OUTPUT);
Serial.begin(9600);
}

void loop(){

int val;
int brightness;
int fadeAmount;

val=analogRead(pot);
Serial.print("value =");
Serial.println(val);

analogWrite(LED, brightness=val);
delay(30);

}
It is the code, if someone need it because i dont know why he didn't put it like this

Nourrgado
Автор

or u can use this

int LED=11;
int pot=0;
int val;
int fade;

void setup(){

pinMode(LED, OUTPUT);
Serial.begin(9600);

}

void loop(){

val=analogRead(pot);
Serial.print("value =");
Serial.println(val);

for(fade=0;fade<255;fade++){

analogWrite(LED, val);

}

for(fade=255;fade>=0;fade--){

analogWrite(LED, val);

}

}

u can use both

Nourrgado
Автор

The schematic is wrong. It shows the pot hooked up to pin 11 and nothing hooked up to pin 0

samwest
Автор

How to Control the brightness of the led as well as the status (on/off) of the led via the serial communication?
It should be in a single code.

Akhilkapz
Автор

its wrong. the code is right, but the schematic is wrong. there must be no pin for 5v. because the pin 11 is set as the output, which means the pin 11 itself will give the voltage to the potentiometer, and not the ardiuino direct to the led. samee schematic and code, only remove the wire going to 5v

gurpreetdol
Автор

you confused people for this simple stuff

ajitdalvi
Автор

it is not connected, it's just for make it steady

TutorialsArduino
Автор

Will it work if you don't connect the Arduino into the Breadboard?

andregomesnf
Автор

give give me the code...bro...I badly need it

reazulislam
welcome to shbcf.ru