mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
34 lines
755 B
JavaScript
34 lines
755 B
JavaScript
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})`;
|
|
},
|
|
}
|
|
);
|