InoDrive / IO / getInput


InoDrive.IO.getInput(input)

Get Voltage State of Specific Configurable Input.

Arguments:
Digital Input (Number) Module’s Input Range (0 to 3).

Returns:
Input Voltage Signal (Boolean) Low(0) or High(1)
• 0 – Low
• 1 – High

// Import InoDrive API Library
import { InoDriveApiJS }  from "ck-inodrive-api" 

// Instatiate the API
let InoDriveApi = new InoDriveApiJS.InoDriveApi({ connectAppUrl: "", secure: false })

// Instantiate InoDrive Object
let Drive = await InoDriveApi.InoDrive({ target: "Name", autoConnect: true })

// Get All Input States
let inputs = [0, 1, 2, 3] 
for (let i in inputs) {
    let state = await Drive.IO.getInput(i)
    if (state == 0) {
        console.log(`Input ${i} is low`)
    } else {
        console.log(`Input ${i} is high`)
    }
}