#include <LiquidCrystal.h>
LiquidCrystal lcd(18, 5, 17, 16, 4, 0);
int led_pin = 12;
int analog_pin = 12;
void setup() {
lcd.begin(16, 2);
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(analog_pin, INPUT);
pinMode(led_pin, OUTPUT);
}
void loop() {
int analogstatus = analogRead(analog_pin);
Serial.println(analogstatus);
analogWrite(led_pin, analogstatus);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("analogValue:");
lcd.print(analogstatus);
if (analogstatus > 0)
{
lcd.setCursor(5, 1);
lcd.print("led on");
}
else if(analogstatus==0)
{
lcd.setCursor(5,1);
lcd.print("led off");
}
// put your main code here, to run repeatedly:
delay(1000); // this speeds up the simulation
}