Skip to content

Instantly share code, notes, and snippets.

@aeciolevy
Created February 17, 2020 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aeciolevy/c5cc51a7209099500d417ea58bc3fe2c to your computer and use it in GitHub Desktop.
Save aeciolevy/c5cc51a7209099500d417ea58bc3fe2c to your computer and use it in GitHub Desktop.
const net = require('net');
const client = net.createConnection({ host: '192.168.7.2', port: 9999 });
const delay = time => new Promise(resolve => setTimeout(resolve, time));
client.on('data', (data) => {
data = data.toString().trim();
console.log('data received: ', data);
});
(async function main() {
client.write('estop/status');
await delay(2000);
client.write('estop/trigger/request');
await delay(5000);
client.write('estop/release/request');
await delay(2000);
client.write('estop/systemreset/request');
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment