#include<LiquidCrystal.h>
LiquidCrystal lcd(18, 5, 17, 16, 4, 0);
int analog_pin = 12;
int led_pin = 4;
void setup() {
Serial.begin(115200);
pinMode(led_pin, OUTPUT);
pinMode(analog_pin, INPUT);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// print a message to the LCD.
lcd.print("analog value:,led_on/off");
}
void loop() {
lcd.clear();
lcd.print("analog status:");
lcd.setCursor(0, 1);
if (analog status > 0); {
lcd.setCursor(5, 1);
println("led on");
}
else if (analog status = 0); {
lcd.setCursor(5, 0);
println("led off");
}
int analogstatus = analogRead(analog_pin);
Serial.println(analogstatus);
analogWrite(led_pin, analogstatus);
analogWrite(led_pin, 4095);
delay(1000);
analogWrite(led_pin, 0);
delay(1000);
}