Notifications
Clear all

Level device using the MPU6050

4 Posts
4 Users
1 Likes
504 Views
lhops
(@lhops)
Member
Joined: 1 year ago
Posts: 13
Topic starter  

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?

This topic was modified 12 months ago 2 times by lhops

   
Quote
(@davee)
Member
Joined: 3 years ago
Posts: 1680
 

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


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 

@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.

 

Anything seems possible when you don't know what you're talking about.


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6970
 

@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

Screenshot 2023 05 11 at 20.31.11

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote