I have an error message in my code, i am try to show serial monitor displayed to LCD 20x4. before add lcd script, arduino succesfull compile. but after input lcd crystal, showed "lvalue required as left operand of assignment
"anyone can help me?
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#define MQ_sensor A0
LiquidCrystal_I2C lcd(0x27,20,2);
void setup()
{
lcd.init();
Serial.begin(9600);
Serial.println("NH3 in PPM");
Serial.println("TEST");
delay(3000);
}
void loop() {
float VRL = 0.0;
float Rs = 0.0;
float ratio = 0.0;
float RL = 47;
float m = -0.243;
float b = 0.42;
float Ro = 91.42;
unsigned int analog_value=0;
lcd.setCursor(0,0);
lcd.print("PPM");
for(int test_cycle = 1 ; test_cycle <= 500 ; test_cycle++)
{
analog_value = analog_value + analogRead(MQ_sensor);
delay(3);
}
float analog = float(analog_value)/500.0;
VRL = analog*(5.0/1023.0);
//Serial.println(VRL);
Rs = ((5.0 * RL) / VRL) - RL;
ratio = Rs / Ro;
float ppm = pow(10, ((log10(ratio) - b) / m));
lcd.setCursor(0,1);
lcd.print(ppm);
Serial.print("NH3 (ppm) = ");
Serial.println(ppm);
Serial.print("Voltage = ");
Serial.println(VRL);
Serial.println("");
delay(1000);
}
below is error message:
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:32:0,
from sketch\MK_2.ino.cpp:1:
C:\Users\asus\Documents\Arduino\sensor amoniak mk 1\MK_2\MK_2.ino: In function 'void loop()':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/binary.h:38:19: error: expected unqualified-id before numeric constant
#define B00000001 1
^
C:\Users\asus\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:53:12: note: in expansion of macro 'B00000001'
#define Rs B00000001 // Register select bit
^~~~~~~~~
C:\Users\asus\Documents\Arduino\sensor amoniak mk 1\MK_2\MK_2.ino:17:7: note: in expansion of macro 'Rs'
float Rs = 0.0;
^~
MK_2:36:27: error: lvalue required as left operand of assignment
Rs = ((5.0 * RL) / VRL) - RL;
^~
exit status 1
lvalue required as left operand of assignment