Porting Library to Particle

Hello @ScruffR do you know how to port this Arduino library to Particle Boron environment?

Thanks in advance!

In case @ScruffR is taking a well earned summer break - I can offer my advice:

in ADS7828.h
Replace

#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

#include <Wire.h>

With
#include "Particle.h"

Then in ADS7828.cpp
Delete

#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

#include <Wire.h>

You may need to #include "Particle.h" in its place

In function i2cread()
Replace

    #if ARDUINO >= 100
        return Wire.read();
    #else
        return Wire.receive();
    #endif

With
return Wire.read();

In function i2cwrite()
Replace

    #if ARDUINO >= 100
        Wire.write((uint8_t)x);
    #else
        Wire.send(x);
    #endif

With
Wire.write(uint8_t)x);

There are some changes to using Wire.beginTransmission() with OS 1.5.0 and later - but what is there should still work. Best that you compile using Particle Workbench.

3 Likes

Thanks a lot @armor! I will try it!

My advice is to use the ADS1115. :wink:

1 Like

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