From 3c05ccf9ce86fcdac53cb08c20a3ba530119d170 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Tue, 15 Oct 2019 20:38:53 +0900 Subject: [PATCH] docs: fix undefined variable --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0aa64ab..4125984 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ GPIO access with Node.js ```js const { requestGPIOAccess } = require("@notweb/gpio"); +const { promisify } = require("util"); +const sleep = promisify(setTimeout); async function main() { const gpioAccess = await requestGPIOAccess(); @@ -14,8 +16,10 @@ async function main() { await port.export("out"); for (;;) { - await port.write(value); - await new Promise(resolve => setTimeout(resolve, 1e3)); + await port.write(1); + await sleep(1000); + await port.write(0); + await sleep(1000); } }