Hello,
I am new to programing and I've encountered a weird problem. The program worked twice, bu now it doesn't and I wanted to know if it was because of something I changed in it. Basically, I have a lcd screen that should display different text depending on the input from a microphone (A0).
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,16,2);
int MIC = 0; //the microphone amplifier output is connected to pin A0
int analogPin = A0;
void setup() {
Serial.begin(9600); //sets the baud rate at 9600 so we can check the values the microphone is obtaining on the Serial Monitor
lcd.init();
}
void loop(){
//Serial.println (adc);//Print ADC for initial calculation
MIC = analogRead(analogPin);
Serial.println(MIC);
if (MIC>25)
{
lcd.backlight();
lcd.noDisplay();
lcd.setCursor(4,0);
lcd.print("Volume:");
lcd.setCursor(7,1);
lcd.print("Eleve");
}
if (MIC=21)
{
lcd.backlight();
lcd.noDisplay();
lcd.setCursor(4,0);
lcd.print("Volume:");
lcd.setCursor(0,1);
lcd.print("Normal");
}
}