Raspberry Pi的GPIO包装器安装 npm install -S node-pi-gpio 用法 L chika npm run example:l_chika
GPIO = require 'node-pi-gpio'
pin = 24
time = 500
_loop = (gpio, val) ->
gpio.value val
setTimeout _loop, time, gpio, (unless val then 1 else 0)
GPIO.open pin, 'out'
.then (gpio) ->
process.on 'SIGINT', ->
gpio.value 0
gpio.close()
.then -> process.exit()
_loop(gpio, 1)
return
暂无评论