LymeRegis:
Is it generally best to use the Web editor or the local IDE and specifically in this case isn't using the IDE better as it avoids all the duplicated libraries in the Web editor?
Having all those libraries pre-installed can be convenient, because it means you don't need to figure out how to install libraries very often. On the other hand, those libraries are installed whether you like it or not. With the standard Arduino IDE, you have complete control over everything.
There's always a way to get around issues caused by the pre-installed libraries in the Arduino Web Editor. You can easily install the libraries you need with the standard Arduino IDE.
So it really is just a matter of preference. It's nice that we have choices. If you value having a cloud based solution, then the Arduino Web Editor is going to be a good choice. It can also be useful as an alternative for people who have problems getting the Arduino IDE working on their computer (and vice versa). If you don't like the Arduino Web Editor, then you always have the option of the free, open source Arduino IDE.
LymeRegis:
I switched the #include directive as you suggested but still couldn't get it to work on the web editor.
I'm sorry to hear that. It compiled without error for me after switching the order of the #include directives. I'm sure I could help you solve the problem with the Arduino Web Editor if you like, but it sounds like you are giving the Arduino IDE a try now.
LymeRegis:
However, an overflow error is reported and the program stops.
If you post the full and exact text of the error I'll take a look. I don't remember whether I have a MPU6050, so I might be limited in how far I can investigate this, but there are plenty other people here on the forum to provide assistance if I can't.
LymeRegis:
There is still a long list of errors reported at compile time.
Are you sure they aren't warnings? If there are compilation errors, the sketch wouldn't upload to your board.
LymeRegis:
As you know, the link in the program text is to I2cdevlib-master. This folder has an arduino subdirectory with MPU6050 directory that contains .h file etc etc. So I copied the folder to the IDE library. Same with I2Cdev. Is this correct?
I can't say without knowing where you copied it to. Although it will work, you should never install libraries to the libraries subfolder of the Arduino IDE installation folder. The reason is that everything in the Arduino IDE installation folder is lost every time you update the Arduino IDE. You don't want to have to re-install everything every time you update the IDE, and if you save any irreplaceable files to the IDE folder that would be a real disaster. The correct place to install libraries is to the libraries subfolder of the sketchbook folder. You can find the location of the sketchbook folder in the Arduino IDE at File > Preferences > Sketchbook location.
But really, you don't need to even think about any of that. The Arduino IDE has a feature that automatically installs libraries to the correct location. This is how I would recommend installing the i2cdevlib libraries:
- Download the i2cdevlib project: https://github.com/jrowberg/i2cdevlib/archive/master.zip
- Unzip the downloaded file.
- (In the Arduino IDE) Sketch > Include Library > Add .ZIP Library...
- Select the Arduino/I2Cdev subfolder of the unzipped i2cdevlib-master folder.
- Click the "Open" button.
- Wait for the Arduino IDE to indicate the library was successfully installed on the status bar.
- Repeat the process with the Arduino/MPU6050 folder.
I should mention that the "Install .ZIP Library..." feature's ability to install libraries from folders as well as .zip files was recently lost in the Microsoft Store version of the Arduino IDE, but it still works in all other version of the Arduino IDE (including the standard Windows versions).