How to set up rapid variabel monitor

Ricki88 Finland
Working on an Web services application for Omnicore flexpendant. 
I'm trying to set up an rapid variabel monitor that executes when rapid variable value is changed but cant get it to work.
In the Application manual Omnicore App SDK 1.1 I found that with RWS.Rapid.getMonitor() it is possible. Still can't get it to work?

            let monitorbStart = await RWS.Rapid.getMonitor('bStartMoveTo', 'T_ROB1')
            monitorbStart.addCallbackOnChanged((status) => {
                if (status = false) {
                    // Stop movement
            await monitorbStart.subscribe();

What I'm doing wrong?
Please help! 


  • Fritz
    Fritz Tallinn
    edited June 2
    Hi !

    As I understand it, with getMonitor() you can  subscribe to controller state and mode changes. To subscribe to RAPID variable change, I'm using RWS.Rapid.getData() instead.

            _myVariableRef = await RWS.Rapid.getData('T_ROB1', 'myModule', 'myVariable');
            await _myVariableRef.addCallbackOnChanged((newValue) =>
                // do something with newValue
            await _myVariableRef.subscribe()