Skip to content

Commit a345101

Browse files
committed
Configure pull-up bias
1 parent 09fabcd commit a345101

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

js/gpio-basic/gpio-basic.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
const gpiod = require('node-libgpiod');
2-
//const fetch = require('node-fetch');
3-
//const jwt = require('jsonwebtoken');
42
const { ArduinoIoTCloud } = require('arduino-iot-js');
53

64
const LED = 14; // GPIO14, Pin 8
@@ -15,8 +13,9 @@ chip = new gpiod.Chip('gpiochip4');
1513
ledLine = chip.getLine(LED);
1614
buttonLine = chip.getLine(BUTTON);
1715

18-
ledLine.requestOutputMode();
19-
buttonLine.requestInputMode();
16+
ledLine.requestOutputMode("gpio-basic");
17+
// To configure the pull-up bias, use 32 instead of gpiod.LineFlags.GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP if it is undefined
18+
buttonLine.requestInputModeFlags("gpio-basic", gpiod.LineFlags.GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP);
2019

2120
let client;
2221

0 commit comments

Comments
 (0)