本文整理匯總了TypeScript中onoff.Gpio.writeSync方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Gpio.writeSync方法的具體用法?TypeScript Gpio.writeSync怎麽用?TypeScript Gpio.writeSync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類onoff.Gpio
的用法示例。
在下文中一共展示了Gpio.writeSync方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
var toggleLed = function():void {
var lastState:number = led.readSync();
led.writeSync(lastState ^ 1);
};
示例2: setTimeout
setTimeout(function() {
clearInterval(intervalId);
led.writeSync(0);
led.unexport();
}, 2000);
示例3: turnOff
export function turnOff(pin: number): void {
const target = new Gpio(pin, 'out');
target.writeSync(OFF);
target.unexport();
}
示例4: writeToPin
writeToPin(newState: boolean): When.Promise<GpioState> {
this.gpio.writeSync(newState ? 1 : 0);
return this.readPin();
}
示例5: toggle
export function toggle(pin: number): void {
const target = new Gpio(pin, 'out');
target.writeSync(target.readSync() === OFF ? ON : OFF);
target.unexport();
}