2
This commit is contained in:
parent
170cbb7792
commit
1413decbe0
@ -14,7 +14,7 @@ pins.forEach(pin => {
|
|||||||
|
|
||||||
|
|
||||||
// Function to toggle a pin on-then-off
|
// 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) => {
|
exec(`python3 src/python/gpio_interface.py toggle ${pin}`, (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
return callback(error);
|
return callback(error);
|
||||||
@ -27,7 +27,7 @@ function togglePin(pin, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Function to sense a pin state
|
// 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) => {
|
exec(`python3 src/python/gpio_interface.py sense ${pin}`, (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(`Error sensing pin ${pin}: ${error.message}`);
|
console.error(`Error sensing pin ${pin}: ${error.message}`);
|
||||||
@ -43,7 +43,7 @@ function sensePin(pin, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Toggle pins sequentially and then sense pin states
|
// Toggle pins sequentially and then sense pin states
|
||||||
function debugInit() {
|
export function debugInit() {
|
||||||
pins.forEach(async (pin) => {
|
pins.forEach(async (pin) => {
|
||||||
switch (pin.mode) {
|
switch (pin.mode) {
|
||||||
case 'OUT':
|
case 'OUT':
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
// Import modules
|
// Import modules
|
||||||
import gpio from './custom_modules/VoidGPIO.js';
|
const gpio = require('./custom_modules/VoidGPIO.js');
|
||||||
|
|
||||||
// List of pins for toggling
|
|
||||||
const togglePins = [7, 13];
|
|
||||||
// List of pins for sensing
|
|
||||||
const sensePins = [16, 22];
|
|
||||||
|
|
||||||
|
gpio.debugInit();
|
Loading…
Reference in New Issue
Block a user