as72652

antoniorruiz/spectrometer-as7265x-triad/as72652

No description
as72652
@/as72652
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
as72652
IN
560nm
585nm
645nm
705nm
900nm
940nm
LED
UPD
940nmnumber
Displays wavelength intensity at 940 nm.
900nmnumber
Displays wavelength intensity at 900 nm.
705nmnumber
Displays wavelength intensity at 705 nm.
645nmnumber
Displays wavelength intensity at 645 nm.
585nmnumber
Displays wavelength intensity at 585 nm.
560nmnumber
Displays wavelength intensity at 560 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_560nm>(ctx, sensor->getCalibratedG());
        emitValue<output_585nm>(ctx, sensor->getCalibratedH());
        emitValue<output_645nm>(ctx, sensor->getCalibratedI());
        emitValue<output_705nm>(ctx, sensor->getCalibratedJ());
        emitValue<output_900nm>(ctx, sensor->getCalibratedK());
        emitValue<output_940nm>(ctx, sensor->getCalibratedL());



        
    }
}