Here would be a possible (untested of course ) generic NodeJS example of how to read and pass on most any GPIO input to a Blynk Widget.
In your case you need to use whatever methods are mentioned here - https://www.udoo.org/docs-neo/Hardware_&_Accessories/GPIO.html - And apply them to code like below.
// setup whatever library method for reading your devices GPIO
const Blynk = require('blynk-library'); // Links variable 'Blynk' to the Blynk Library
const AUTH = 'xxxxxxxxxx'; // Your top secret auth code
const blynk = new Blynk.Blynk(AUTH, options = {
connector : new Blynk.TcpClient()
});
var myValue = // use whatever command to setup your devices GPIO input to this variable
// Automatically update sensor value every 2 seconds
setInterval(function() {
// use whatever command to read your GPIOs variable... in this case myValue
blynk.virtualWrite(0, myValue); // Send the value of the variable myValue to a Widget on V0
}, 2000);
And for another example… but using an RPi and the pigpio library (one of many for the RPi), I can read a DHT sensor with NodeJS and Blynk…
const Gpio = require('pigpio').Gpio; // I use this library to read my devices GPIO pins
var sensorLib = require('node-dht-sensor'); // I use this library, compatible to my device, to interpret the DHT sensors data and assign that control to the variable sensorLib
const Blynk = require('blynk-library'); // Links variable 'Blynk' to the Blynk Library
const AUTH = 'xxxxxxxxxx'; // Your top secret auth code
const blynk = new Blynk.Blynk(AUTH, options = {
connector : new Blynk.TcpClient()
});
// Setup sensor, exit if failed
var sensorType = 11; // 11 for DHT11, 22 for DHT22 and AM2302
var sensorPin = 4; // The GPIO pin number for sensor signal
if (!sensorLib.initialize(sensorType, sensorPin)) {
console.warn('Failed to initialize sensor');
process.exit(1);
}
// Automatically update sensor value every 2 seconds
setInterval(function() {
var readout = sensorLib.read(); // read the sensor and apply the full data to the variable
blynk.virtualWrite(0, readout.temperature.toFixed(0)); // Send parsed temp value to widget on V0
blynk.virtualWrite(1, readout.humidity.toFixed(0)); // Send parsed value to widget on V1
}, 2000);
So… basicly you need to find out how to access your devices GPIO from linux side, then find any sensor specific librarys, if neede, then apply them in much the same way to send the data to Blynk.
Controlling the GPIO from Blynk is much the same way, but using Blynk functions that respond to Widget state changes…
In this code snippets case, I watch for a Blynk Button and reboot my device if it is pressed…
/ ----- RPi Reboot Command -----
var process = require('child_process'); // A Linux library that allows this script to run CLI commands
var RPiReboot = new blynk.VirtualPin(20); // Setup a variable linked to the Reboot Button on V20
RPiReboot.on('write', function(param) { // Watches for Button press
if (param == 1) { // Runs the CLI command if the button on V20 is pressed
process.exec('sudo /sbin/shutdown -r', function (msg) { console.log(msg) });
}
});