Control IO
Interacting with digital inputs, digital outputs and the GPRS unit of the device
Control I/O
const tcr = require(" @phoenixcontactusa/node-tcrouter");
var TCRouter = new tcr("192.168.1.1", 1432, 3000);
//Get the current values of the TC Router IO
TCRouter.getIO()
.then(res => {
console.log(res);
})
.catch(e => {
console.log(e);
});//Turn the built in digital output on or off
//requires configuration from the web based management of the device
TCRouter.controlOutput(1, true)
.then(() => {
console.log("Turned the digital output to off");
//Confirm the new state of the IO using getIO
TCRouter.getIO().then((newState)=>{console.log(newState})
})
.catch(e => {
console.log("Error controlling output", e);
});Last updated