read via Javascript from SBC4
Posted: Sat Feb 01, 2025 7:57 am
I'm trying to read a MUJIE ENC4124_0 via quadrature encode and SBC4.
This is the first time I've used the SBC4. In the control panel I can see the data on port 1 after I updated everything.
Now I would like to run it via a local server using JavaScript.
I wanted to read the encoder data via the network server and the local adress. I downloaded the encoder example, but it says no phidget available. How do I go about reading the SBC4 over the internet via a local network server, how do I set this up, or how can I read the data directly from the SBC4.
Even if I connect directly to the SBC, there is no websocket:
And is there a basic component of a Phidget for Vue3.
This is the first time I've used the SBC4. In the control panel I can see the data on port 1 after I updated everything.
Now I would like to run it via a local server using JavaScript.
I wanted to read the encoder data via the network server and the local adress. I downloaded the encoder example, but it says no phidget available. How do I go about reading the SBC4 over the internet via a local network server, how do I set this up, or how can I read the data directly from the SBC4.
Even if I connect directly to the SBC, there is no websocket:
Code: Select all
async function runExample() {
const conn = new phidget22.NetworkConnection(5661, '192.168.1.105');
try {
await conn.connect();
} catch (err) {
console.error('Error during connect', err);
process.exit(1);
}
const digitalOutput0 = new phidget22.DigitalOutput();
try {
await digitalOutput0.open(5000);
} catch (err) {
console.error('Error during open', err);
process.exit(1);
}
try {
await digitalOutput0.setDutyCycle(1);
} catch (err) {
console.error('Error during setDutyCycle', err);
process.exit(1);
}
setTimeout(async () => {
await digitalOutput0.close();
conn.close();
conn.delete();
}, 5000);
}
runExample();