as72651

antoniorruiz/spectrometer-as7265x-triad/as72651

No description
as72651
@/as72651
IN@/as7265x-device
Pin to set up the device. Has to be connected to the as7265x-device node.
LEDboolean
Pin to set up LED. If 0, the LED will be on. if 1, the LED will be off.
UPDpulse
as72651
IN
LED
UPD
610nm
680nm
730nm
760nm
810nm
860nm
860nmnumber
Displays wavelength intensity at 860 nm.
810nmnumber
Displays wavelength intensity at 810 nm.
760nmnumber
Displays wavelength intensity at 760 nm.
730nmnumber
Displays wavelength intensity at 730 nm.
680nmnumber
Displays wavelength intensity at 680 nm.
610nmnumber
Displays wavelength intensity at 610 nm.
To use the node in your project you should have the antoniorruiz/spectrometer-as7265x-triad 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

node {
    // 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);
        }

        if (!isInputDirty<input_UPD>(ctx))
        return;

        auto sensor = getValue<input_IN>(ctx);
        auto LED = getValue<input_LED>(ctx);

        if (LED == 1){
        sensor->disableIndicator();
        sensor->takeMeasurementsWithBulb();
                    
        }

        
        if (LED == 0){
        sensor->takeMeasurements();

        }
        
        

        emitValue<output_610nm>(ctx, sensor->getCalibratedR());
        emitValue<output_680nm>(ctx, sensor->getCalibratedS());
        emitValue<output_730nm>(ctx, sensor->getCalibratedT());
        emitValue<output_760nm>(ctx, sensor->getCalibratedU());
        emitValue<output_810nm>(ctx, sensor->getCalibratedV());
        emitValue<output_860nm>(ctx, sensor->getCalibratedW());



        
    }
}