Looking for help migrating a couple of libraries

Hi there

I am looking for some assistance migrating a couple of libraries to work on a Particle Argon.

I’m looking to use the Grove Digital Light sensor TSL2561and Grove Temperature and Humidity sensor TH02 with an Argon via the Grove shield.

I’ve read up a bit on the forums and I understand I need to replace Arduino.h with Particle.h and don’t need to call Wire.h as it’s automatically included. I have also read something about potentially changing variable datatypes based on the fact the Argon has a 32bit architecture.

I have had a crack at this in Visual Studio Code with Particle Workbench installed and IntelliSense goes crazy when I try not to include Wire.h in the library files.

See below:
Digital_Light_TSL2561.cpp
Digital_Light_TSL2561.h
TH02_dev.cpp
TH02_dev.h

Any guidance on whether my understanding outlined above is correct and whether I’m on the right track with the link files would be greatly appreciated.

That's probably because VS Code doesn't recognise your project as targeting the Particle platform.
You may need to Particle: Create Project first and then add the libraries to that project in order to have VS Code understand the context.

You know when VS Code knows it's dealing with a Particle project when you see these in the top right
image
and this in the status bar at the bottom
image

I used the Particle: Create Project command. See screenshots.


Since REG_CONFIG and CMD_MEASURE_TEMP are defined in TH02_dev.h and not in Wire.h it is quite surprising that these flags would go away when including Wire.h.
Hence this seems to be a case of bad IntelliSense resolution (again).

Have you tried building the project and do the IntelliSense flags persist after that?

BTW, there are several threads that deal with IntelliSense issues - maybe you can find some hints how to solve this there
https://community.particle.io/search?q=intellisense

Verifies and compiles fine.

I did see in another thread you mentioned IntelliSense being fairly temperamental. I’ll take a look at those threads. Probably something I can learn to ignore.

Outside of issues with IntelliSense is my understanding and implementation of the migration process correct?

When it works it obviously is :wink:

One additional note on the datatypes you mentioned: It’s not only the types but also the endianness which might (does) differ between platforms that needs consideration.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.