int analog_pin = 7;
int led = 9;
float val;
float volt;
void setup() {
pinMode(led, OUTPUT);
Serial.begin(115200);
}
void loop() {
val = analogRead(analog_pin);
volt = val*5/1024;
Serial.print("ADC : ");
Serial.print(val);
Serial.print(" Volt : ");
Serial.println(volt);
delay(500);
if(volt<0.05){
digitalWrite(led, LOW);
}else{
analogWrite(led, volt*50);
}
}