UNPKG
bot-io
Version:
latest (1.0.2)
1.0.2
1.0.1
1.0.0
0.1.1
0.1.0
ADC, GPIO, PWM, UARTs, and more on the BeagleBone Black.
github.com/fivdi/bot-io
fivdi/bot-io
bot-io
/
test
/
gpio-lightswitch.js
16 lines
(12 loc)
•
313 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict'
;
var
bot =
require
(
'../'
), button =
new
bot.
Gpio
(bot.
pins
.
p9_23
, {
direction
: bot.
Gpio
.
IN
,
pullType
: bot.
pullTypes
.
PULL_UP
}), led =
new
bot.
Gpio
(bot.
pins
.
p9_26
); bot.
once
(
'ready'
, [button, led],
function
(
) {
setInterval
(
function
(
) { led.
value
(button.
value
()); },
20
); });