as72653

antoniorruiz/spectrometer-as7265x-triad/as72653

Pin to set up the device. Has to be connected to the as7265x-device node.
as72653
@/as72653
Pin to set up the device. Has to be connected to the as7265x-device node.
IN@/as7265x-device
LEDboolean
Pin to set up LED. If 0, the LED will be on. if 1, the LED will be off.
UPDpulse
as72653
IN
410nm
435nm
460nm
485nm
510nm
535nm
LED
UPD
535nmnumber
Displays wavelength intensity at 535 nm.
510nmnumber
Displays wavelength intensity at 510 nm.
485nmnumber
Displays wavelength intensity at 485 nm.
460nmnumber
Displays wavelength intensity at 460 nm.
435nmnumber
Displays wavelength intensity at 435 nm.
410nmnumber
Displays wavelength intensity at 410 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_410nm>(ctx, sensor->getCalibratedA());
        emitValue<output_435nm>(ctx, sensor->getCalibratedB());
        emitValue<output_460nm>(ctx, sensor->getCalibratedC());
        emitValue<output_485nm>(ctx, sensor->getCalibratedD());
        emitValue<output_510nm>(ctx, sensor->getCalibratedE());
        emitValue<output_535nm>(ctx, sensor->getCalibratedF());


        
    }
}