This commit is contained in:
Skylar Grant 2024-08-18 13:10:10 -04:00
parent 170cbb7792
commit 1413decbe0
2 changed files with 5 additions and 9 deletions

View File

@ -14,7 +14,7 @@ pins.forEach(pin => {
// Function to toggle a pin on-then-off
function togglePin(pin, callback) {
export function togglePin(pin, callback) {
exec(`python3 src/python/gpio_interface.py toggle ${pin}`, (error, stdout, stderr) => {
if (error) {
return callback(error);
@ -27,7 +27,7 @@ function togglePin(pin, callback) {
}
// Function to sense a pin state
function sensePin(pin, callback) {
export function sensePin(pin, callback) {
exec(`python3 src/python/gpio_interface.py sense ${pin}`, (error, stdout, stderr) => {
if (error) {
console.error(`Error sensing pin ${pin}: ${error.message}`);
@ -43,7 +43,7 @@ function sensePin(pin, callback) {
}
// Toggle pins sequentially and then sense pin states
function debugInit() {
export function debugInit() {
pins.forEach(async (pin) => {
switch (pin.mode) {
case 'OUT':

View File

@ -1,8 +1,4 @@
// Import modules
import gpio from './custom_modules/VoidGPIO.js';
// List of pins for toggling
const togglePins = [7, 13];
// List of pins for sensing
const sensePins = [16, 22];
const gpio = require('./custom_modules/VoidGPIO.js');
gpio.debugInit();