I have download the sketch that Bill used in his demo video to the Arduino IDE. But when I run the compile I get this error:
Bill's video is titled "Build an Electronic Level with MPU-6050 and Arduino"
C:\Users\Leon\AppData\Local\Temp\.arduinoIDE-unsaved2023411-32620-19jun3n.ih18\sketch_may11a\sketch_may11a.ino:24:65: error: 'POSITIVE' was not declared in this scope
LiquidCrystal_I2C lcd(i2c_addr, en, rw, rs, d4, d5, d6, d7, bl, POSITIVE);
^~~~~~~~
C:\Users\Leon\AppData\Local\Temp\.arduinoIDE-unsaved2023411-32620-19jun3n.ih18\sketch_may11a\sketch_may11a.ino: In function 'void setup()':
C:\Users\Leon\AppData\Local\Temp\.arduinoIDE-unsaved2023411-32620-19jun3n.ih18\sketch_may11a\sketch_may11a.ino:60:17: error: no matching function for call to 'LiquidCrystal_I2C::begin(int, int)'
lcd.begin(16,2);
^
In file included from C:\Users\Leon\AppData\Local\Temp\.arduinoIDE-unsaved2023411-32620-19jun3n.ih18\sketch_may11a\sketch_may11a.ino:16:0:
c:\Users\Leon\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.h:76:7: note: candidate: void LiquidCrystal_I2C::begin()
void begin();
^~~~~
c:\Users\Leon\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.h:76:7: note: candidate expects 0 arguments, 2 provided
exit status 1
Compilation error: 'POSITIVE' was not declared in this scope
Can someone help me to correct the code?
Hi @lhops,
I haven't worked on this , so others may be able to direct you more accurately, but I notice this bug seems to frequently reappear.
I note a suggestion that it can be due to selecting the wrong version of library, which seems plausible, as Arduino libraries with similar names are rather common.
----------
Start by looking at:
https://forum.dronebotworkshop.com/project-help/need-help-with-lcd-i2c-project/
If that doesn't help, try Googling the most crucial part of the error string .. something like
error: 'POSITIVE' was not declared in this scope LiquidCrystal_I2C
You will soon see you are not the first, and hopefully you will find an answer.
Please post back your solution ... which may be helpful to someone else in the future
... or lack of solution, which might prompt another suggestion to try.
Good luck, Dave
@lhops
The problem is that you're using the wrong version of the LiquidCrystal_I2C library.
Unfortunately there is more than one version and its not always easy to tell them apart, so it's hard to tell which version you have and which version you need :/
I suspect (but can't guarantee) that you'll need the version by Frank de Brabander. Try using the library manager to remove your current version and add his version.
I had a psychic girlfriend but she left me before we met.
@lhops I am away at the moment, but that error is caused by one of two things, I just don't remember which.
#1 to check is make sure the library is in the list of installed libraries.
#2 The LCD interface is changed, the long list of arguments is gone, it's now only 3 I think.
Try the TinyLiquidCrystal library, the init looks like the attached pic
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting