To use the node in your project you should have the antoniorrg/scd4x library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
#pragma XOD require "https://github.com/sparkfun/SparkFun_SCD4x_Arduino_Library"
#include <Wire.h>
#include "SparkFun_SCD4x_Arduino_Library.h"
node {
meta {
// Define our custom type as a pointer on the class instance.
using Type = SCD4x*;
}
// Create an object of class Adafruit_TSL2591
SCD4x mySensor = SCD4x();
// Internal state variables defined at this level persists across evaluations
Number foo;
uint8_t bar = 5;
void evaluate(Context ctx) {
bar += 42;
if (isSettingUp()) {
// This run once
foo = (Number)(bar + 1);
}
Wire.begin();
mySensor.begin();
emitValue<output_OUT>(ctx, &mySensor);
}
}