mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
Initial commit
moved from private version control
This commit is contained in:
33
scripts/nodes/library/gpio/gpioRead.js
Normal file
33
scripts/nodes/library/gpio/gpioRead.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Reads a value from a GPIO pin using gpio().
|
||||
*/
|
||||
export const gpioReadNode = createNodeModule(
|
||||
{
|
||||
id: "gpio_read",
|
||||
title: "GPIO Read",
|
||||
category: "IO",
|
||||
description: "Fetch the current value of a GPIO pin.",
|
||||
searchTags: ["gpio", "hardware", "input"],
|
||||
inputs: [
|
||||
{
|
||||
id: "index",
|
||||
name: "Pin",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "value", name: "Value", direction: "output", kind: "number" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
const pin = resolveValueInput("index", "0");
|
||||
return `gpio(${pin})`;
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user