Problems with the .h file in libraries or maybe just the ADAFRUIT_ILI9341 library

Problems with the ADAFRUIT_ILI9341 0.9.1 library

three files listed:
ADAFRUIT_ILI9341.CPP
ADAFRUIT_ILI9341.H
TESTGFX.INO

I select ‘TESTGFX.INO’ and the source code appears in the main window.

I click on “Use this example”

As I expected I get this error message:
testgfx.cpp:18:43: fatal error: Adafruit_mfGFX/Adafruit_mfGFX.h: No such file or directory

I go to the Libraries page and click on ADAFRUIT_MFGFX 1.0.1 and click on “include in app”. Then click on TESTGFX when it asks “which app”.

Now it lists both:
ADAFRUIT_ILI9341
ADAFRUIT_MFGFX
as Included Libraries.

So far so good. However, when I try to compile this, I get and error message of:
testgfx.cpp:22:30: fatal error: Adafruit_ILI9341.h: No such file or directory

Can someone tell me what I’m doing wrong or not doing?

I can use the NOKIA-5110-LCD 0.0.7, which also has its own include .h header file in it and I don’t get a problem nor do I have to explictly load that .h file.

Is there something I have to do, to load the header files that are in a library package? I assumed that those automatically got loaded when the library did.

Thanks.

@MarkSHarrisTX, creating IDE libraries can be tricky and rules changed over time. So when @mtnscott created the ili9341 library, the path rules were different. All you have to do is change the path in one line in testgfx.ini (the example). Change line 22:

#include "Adafruit_ILI9341.h"

to

#include "Adafruit_ILI9341/Adafruit_ILI9341.h"

It will then compile :smile:

1 Like

Wow. Now it compiles. Still not getting displays but I need to make sure my wiring checks with what this program wants.

I’ve spent several weeks banging my head on this, although part of the problem was getting access to this community. I had assumed that if code was in the regular libraries and particularly 30 sometimes, that things like this would have been corrected.

I take it, that since the copies in the Library section must just be copies of what is available in someone’s gethub that they (@mtnscott) have to change it there? That even I, can’t correct it in the library? I can see pros and cons to that.

Thank you very much for the quick and accurate reply.

@MarkSHarrisTX - I updated the include paths to support the latest version of the WebIDE. I apologize for the lost time and confusion. You will find the updated Adafruit_ILI9341 library example compiles just fine after you include the Adafruit_mfGFX library. (Sure would be nice to be able to specify additional support libraries to a library)

@peekay123 - Thanks for helping out.

@mtnscott, you rock as usual. I should have posted a PR on your repo :stuck_out_tongue:

1 Like

@mtnscott, I optimized the library code to run as at DIV2 which produces an SPI clock of 18MHz. If you share your code, I can look at optimizing that. I posted the updated library here. :smile:

2 Likes

I thought a DIV2 would = 36Mhz, and DIV4 = 18Mhz.

@mtnscott, I did also until I was pointed to the clock tree by @mohit if I remember correctly :wink:

@MarkSHarrisTX

@peekay123 did a great job optimizing this library. v0.9.4 is now available in the web IDE. You should see a noticeable improvement in the speed writing to the display.

Enjoy!

1 Like

Thanks. I’ve now got the display running the demo program with all sorts of different displays. Now to start modifying if for my application and adding in all the other inputs.

At least now I’m not flying so blind and I should be able to use the display to show progress and error messages. I still haven’t figured out how to get such messages over the USB port. Such are the trials and tribulations of not having a true system level debugger. Maybe if I can now work and get the Spark-CLI working on my Mac. :frowning:

To get your messages out on the serial port (USB) you can use simple Serial.print("This is a debug message")

In your setup()

Serial.begin(9600);
Serial.print("In Setup");

Then on the Mac use the screen command

screen -L /dev/cu.usbmodemfa131 9600

To find your specific device (in case the above does not work) look in your /dev folder

ls /dev/cu.usb*

You need to wait for your Spark core to completely boot (breathing cyan) before you type the screen command. Also after you reset your core (or it crashes) your terminal console will be in a strange state, just type reset and it will be restored to normal.

Good Luck

1 Like

@peekay123 if I want to include the same library in several different projects, how should I go about it ? Do I have to duplicate the library header and cpp files ?

@dustpuppy, how are you compiling - web IDE, CLI, DEV or locally?

@peekay123 I am developing in Particle Dev. I need to check my files into git. It took me some time to understand that one directory can only have one “main script” (with setup() and loop()). I will probably have 3 “main” scripts, and will be using community libraries. It seems silly to have to duplicate the libraries, and I’m hoping to develop shared libraries between my projects.

@peekay123 sorry I didn’t fully answer. I am developing in Particle Dev, and using the “Compile in cloud and upload using cloud” button. Should I invest time in learning how to compile with the CLI or locally ?

@dustpuppy, I hear you! For now, you need to have three unique directories with duplicate library files. The long game that the Particle Team is working on will allow for a library repository like arduino. I use CLI because it adds a lot of extras that DEV hasn’t got (yet) like doing a publish or setting up a webhook. Compiling with CLI is super simple so DO check it out for yourself! :smile:

@peekay123 understood, thanks. I can live with that for the time being, I might look into setting up symlinks or something similar.

1 Like

Why are the basics so hard??

I’ve been having troubles with a simple weather sensor, so I started a new test.ino to step through it one at a time. I added two simple libraries and it still has problems. Why can’t the Particle system be more reliable? Need a Library, Add the Library, Verify and it works. Nope.

I simply added these two lines:

#include "blynk/blynk.h"
#include "Adafruit_BMP085/Adafruit_BMP085.h"

I verified and it kicked out this?

    In file included from blynk/BlynkParticle.h:16:0,
                 from blynk/BlynkSimpleParticle.h:14,
                 from blynk/blynk.h:2,
                 from test_libraries.cpp:1:
blynk/BlynkApiParticle.h:78:6: warning: #warning "analogInputToDigitalPin not defined => Named analog pins will not work" [-Wcpp]
     #warning "analogInputToDigitalPin not defined => Named analog pins will not work"
      ^
test_libraries.cpp:2:45: fatal error: Adafruit_BMP085/Adafruit_BMP085.h: No such file or directory
 #include "application.h"
                                             ^

compilation terminated.
make[1]: *** [../build/target/user/platform-6test_libraries.o] Error 1
make: *** [user] Error 2

If you want to add a library, it’s not enough to add the #include you’d need to import the library via the library tab of Particle Build (aka Web IDE)

If you use the tools right they do work reliable.

That was not helpful.

Is it your goal to make condescending comments to people trying to learn, who don’t share your advanced learning degree specific to a topic on Community Forums? I followed the instruction on Particle:

“You can include a library in an application by opening the library drawer, finding a library that will work for your project, and clicking the “include in app” button. This will add an #include statement to your code that will expose all the capabilities of the library to your code.”