LiquidCrystal library problems

Hi, I’m new with the spark core and I’ve been having troubles with the LiquidCrystal library. Could anybody help me, please?

In file included from spark-hellosparky.cpp:2:0:
LiquidCrystal.h:42:36: error: expected class-name before ‘{’ token
class LiquidCrystal : public Print {
^
LiquidCrystal.h:44:25: error: expected ‘)’ before 'rs’
LiquidCrystal(uint8_t rs, uint8_t enable,
^
LiquidCrystal.h:47:25: error: expected ‘)’ before 'rs’
LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
^

Do anyone have a LiquidCrystal library updated??

thanks :smile:

The lib was aparently put online before some changes to the Web IDE took place, but this is easy to solve.

First you can comment out the line #include "application.h" and next you need to change #include "LiquidCrystal.h" into #include "LiquidCrystal/LiquidCrystal.h"

Then it should build :wink:

3 Likes

Hi,

I’m getting the same error trying to build using the Web IDE but using the Photon. I’ve made the changes recommended by @ScruffR to no avail.

Does this library still need massaging to work with the Photon?

I am just using the supplied Spark-HelloSparky.cpp example code.

Thanks

No idea why you are seeing errors, since when I use the example with above errors for Photon, it just builds without errors.

Can you provide a screenshot of your IDE showing the top 50 code lines?

Hi @ScruffR

For the time being this is sort of solved as my display is up and running. There is however some strange goings on, Here’s the list of events.

  1. Last night created a brand new app and cut and pasted Spark-HelloSparky.cpp, Clicked verifiy, Error.
  2. Found this post and made changes you suggested a few months back. No change same errors as the original post
  3. Got your email at work this morning, Opened the Web IDE and clicked verify again, still same error.
  4. Good I thought I’ll remove the big batch of comments at the beginning of the code and post it like you asked. Ran verify once more and magically the code compiled.
  5. Pasted all the comments back in and clicked verify and still compiled
  6. At home tonight opend the Web IDE loaded code and verified, compiled fine.
  7. Uploaded code and LCD fired right up, I’m happy.
  8. Changed the “Hello Sparky!” to “Hello Sweetie!” to impress my better half. :blush:
  9. Click verify and boom, failed again with the same error as already posted
  10. Again remove the large batch of comments and verify again. This time compiled fine. Uploaded and ran fine. Sweetie impressed! :sunglasses:

I find it strangely flakey but if there is something to be learned here it’s “Don’t over comment your code” :no_mouth:

Seriously though if you want me to try anything else to make it fail consistently let me know. If you think I should let sleeping dogs lie then so be it.

Thanks for getting back to me so quickly.

The issue with big comment blocks is somewhat known and due the preprocessor getting confused.

To prevent this, you could prevent the preprocessor from interfering completely, but then you’d need to some of its work yourself:

  • add #pragma SPARK_NO_PREPROCESSOR
  • add #include "application.h"
  • add required function prototypes or make sure that all functions are implemented before the first call to them
2 Likes