How to include a library, because I'm failing :(

Trying to add the adafruit RGB_LCD library, and just not having any luck.

I've forked the main lcd library to
https://github.com/jrubinstein/Adafruit-RGB-LCD-Shield-Library
and tried to 'contribute' that to spark, with no luck.

error message is

Library is not valid, please fix the errors below and resubmit.

Metadata
name: Adafruit-RGB-LCD-Shield-Library
author: Lady Ada
license: BSD
version: 0.0.10
description: Adding the Adafruit-RGB-LCD-Shield-Library to spark
Metadata Validations
spark.json file is present
spark.json file is in the JSON format
spark.json file is valid
version is present
version is in valid format
version is unique
version is greatest so far
name is present
name is unique
author is present
Files and Directories
main header file (firmware/Adafruit-RGB-LCD-Shield-Library.h) was not found
main source file (firmware/Adafruit-RGB-LCD-Shield-Library.cpp) was not found
examples/ folder was not found
license file exists
Documentation
README.md file was found

But those files definitely do exist! Any help would be appreciated.

Thanks,
JR

The name of the library main files (.h/.cpp) have to match the name provided in the spark.json name field.
And the examples folder has to be inside firmware.

But I doubt that this lib will work on :spark: Particle devices. It’ll need porting for this platform.
At least application.h needs to be added and some #includes will need to be altered/removed.

Maybe you’ll need to search the forum for instructions how to port a lib :wink:

Thanks, I was able to get the library imported, and now I can see what you mean by

But I doubt that this lib will work on spark Particle devices. It'll need porting for this platform.
At least application.h needs to be added and some #includes will need to be altered/removed.

Unfortunately, I don't know if I have time/knowledge for all that mess! Why can't we just import things like Arduino?
This really gives me the sads :frowning:

The Particle devices are no Arduino clones but only also use Wiring “language” and hence are somewhat compatible but not 100%.

Porting of libs that are not too tightly bound to the Arduino hardware is not that difficult.
Some starting points you can find here
https://github.com/harrisonhjones/Spark-Ported-Libraries

As @ScruffR said, it can be easier or harder depending on the library. I can take a look at this one tomorrow, if you want me to.

@mumblepins, that would be amazing.
All I want to do is make a web-connected, smart clothes dryer with custom lcd menus; why does that have to be so difficult
:wink:

Alright, it compiles fine, but I don’t have the shield to check it out, so give it a try and let me know if it works. I’ll publish it as a public library once we’re sure it works, but for now just import as a private library https://github.com/mumblepins/Adafruit_RGBLCDShield

1 Like

@mumblepins, you are my hero for doing this!
However, I’m still failing to get the example to work properly.

I get the error message:

Basically particle can’t find the file. I’m having this problem importing another library, also, so it seems probable that I’m just doing something wrong (but I don’t know what). If I try to import the library to the app, it tells me “that library is already in use” or some such.

Anyway, thanks very much for all your help!
JR

Try #include "...." rather than #include <....>

1 Like

@ScruffR, well, that’s interesting. I was compiling against the Photon, and it appears that the Web IDE handles Photon library linking differently. So, @jrubins, do what he said :slight_smile:

did and done! compiles beautifully, now to wire it all up :smile:
thanks again @mumblepins and @ScruffR !

1 Like

Indeed! Are you going to file an issue or should I :wink:

Go for it. I only usually use the Web IDE for quick testing and things like this, so I’m not very familiar with it :confused:.

1 Like

IT WORKS!!!
Hooray!
Thanks very much again for all the help guys, I really appreciate it :slight_smile:
Another thing that may help someone else out, the i2c shield needs to connect to d0 and d1 on the photon, where it was connected to the a4/a5 pins on an Arduino Uno.

The pins here are just labeled SCL and SDA, and don’t say anything about i2c, but I figured it out (eventually)
http://docs.particle.io/photon/photon-datasheet/

BTW @mumblepins, what do you usually use as an IDE if not the web IDE?

1 Like

I do most my main building locally, and use Netbeans as the IDE. It’s helpful when having a bunch of libraries, and when I was building for the Core, I had to strip out a bunch of firmware code to make it fit in the flash.

FYI, I published the library, so other people can use it easily.

1 Like

Just wanted to cc: @Dave on this one. Pretty sure I’ve seen this before as a preprocessor issue.

2 Likes

I do most my main building locally, and use Netbeans as the IDE. It's helpful when having a bunch of libraries, and when I was building for the Core, I had to strip out a bunch of firmware code to make it fit in the flash.

Interesting, how do you flash it to the photon/core if you are using netbeans?

Either locally, with dfu-util, or using the Particle CLI. Video, a bit outdated at this point, but still useful.