DO

序号 设备节点 状态
1 /dev/ido_do
2 /dev/ido_do
3 /dev/ido_do
4 /dev/ido_do
5 GND

设备节点写入”1”后, 对应的常开变为闭合,常闭的变为断开, 写入”0”后对应的闭合回到常开,断开回到常闭;
Java 开发方法参考:

private static void setDo(int id, int on) {
    String path = "/sys/class/leds/relay" + id + "/brightness";
    if (new File(path).exists()) {
        FileWriter writer = null;
            try {
                    writer = new FileWriter(path);
                if (on == 0) {
                    writer.write("0");
                } else {
                    writer.write("1");
            }
            writer.flush();
        } catch (IOException ex) {
            Log.d(TAG, "" + ex);
        } catch (NumberFormatException ex) {
            Log.d(TAG, "" + ex);
        } finally {
            if (writer != null) {
            try {
                writer.close();
                } catch (IOException ex) {
            }
        }
    }
}
文档更新时间: 2021-01-29 17:58   作者:Aeeditor