#define pot A2
#define led 5
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(led,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int pot_output= analogRead(pot);
Serial.println("ADC VOLTAGE =");
Serial.println(pot_output);
int pwm =map(pot_output,0,255,0,1023);
Serial.println("PWM VOLTAGE VALUE");
Serial.println("PWM");
analogWrite(led,pwm);
Serial.println(pot_output);
float voltage =pot_output * 5.0/1023.0;
Serial.println(voltage);
delay(800);
}