/*
keyestudio Easy plug super kit 
Project 37
Decibel tester
http://www.keyestudio.com
*/
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int ledpin=5;// initialize digital pin 5, output regulating the brightness of LED
int val=0;// initialize variable va
int sensorValue=0;
void setup() {
     pinMode(ledpin,OUTPUT);// set digital pin 11 as “output”
     lcd.init();                      // initialize the lcd 
     lcd.init();
     // Print a message to the LCD.
     lcd.backlight();
 }
// the loop routine runs over and over again forever:
void loop()
{
       val= map(analogRead(A0),0,1023,0,255);
       analogWrite(ledpin,val);// turn on the LED and set up brightness（maximum output value 255）
       delay(10);// wait for 0.01 
       
       sensorValue=analogRead(A0);// read the input on analog pin 0:
       lcd.setCursor(1,0);
       lcd.print("SensorValue :  ");
       lcd.setCursor(3,1);
       lcd.print(sensorValue);// print out the value you read:
       delay(1000);  
       lcd.clear();
       delay(1);        // delay in between reads for stability
  
}
/////////////////////////////////////////////////////////////////////
