I have the simple code bellow:
Code: Select all
var runExample = async () => {
var phidgetsConn = new phidget22.NetworkConnection({
hostname: serviceServerConfig["phidgets"]["hostname"],
port: serviceServerConfig["phidgets"]["port"],
name: "Phidget Server Connection",
passwd: "",
onAuthenticationNeeded: function() { return "password"; },
onError: () => {
console.log("Phidgets Networkserver - Connection Error:", msg);
},
onConnect: function() {
console.log("Phidgets Networkserver - Connection is established and MTU is ready to work");
},
onDisconnect: function() {
console.log("Phidgets Networkserver - Disconnected");
}
});
await phidgetsConn.connect().then(() => {})
const bldcMotor0 = new phidget22.BLDCMotor();
bldcMotor0.setHubPort(1);
bldcMotor0.setChannel(0);
bldcMotor0.setDeviceSerialNumber(668208);
bldcMotor0.onAttach = () => {
console.log('Attach!');
};
bldcMotor0.onDetach = () => {
console.log('Detach!');
};
await bldcMotor0.open(5000);
await bldcMotor0.setTargetVelocity(1);
}
runExample();
"Phidgets Networkserver - Connection is established and MTU is ready to work"
That is fine
![Smile :)](./images/smilies/icon_smile.gif)
It feels that the program is failing when the software channel will match with its physical channel, does not it?
I am in Node js for ths exampel. The phidgets server is in the same computer!
Best regards Fredrik