diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2024-03-25 13:10:02 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2024-03-25 13:10:02 +0200 |
| commit | 7913792a6a9c5b651e7caa79fe4f0610272e0f58 (patch) | |
| tree | e7a233122e690d9eabb1b1ba90db2744e09577f4 /robot.js | |
| parent | 5b759155d891fb8348d0b6a44f794db345127a45 (diff) | |
feat: mqtt client
Diffstat (limited to 'robot.js')
| -rw-r--r-- | robot.js | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -1,5 +1,4 @@ -const mqtt = require("mqtt"); -const client = mqtt.connect("mqtt://marcelus.net"); +const client = mqtt.connect("ws://marcelus.net:9001"); function wait(ms) { @@ -47,18 +46,19 @@ async function moveTo(x,y) } -client.on('connect', function () { +client.on('connect', () => { + console.log(client) console.log('Connecté au courtier MQTT'); - client.subscribe('move'); - client.publish('move','ULT1') + client.subscribe('move') + moveTo(1000,1000) }); +// client.publish('move','ULT1') -client.on('message', function (topic, message) { +/* client.on('message', function (topic, message) { console.log('Received from ', topic, ' : ', message.toString()); -}); +}); */ -client.on('close', function () { +/* client.on('close', function () { console.log('Déconnecté du courtier MQTT'); -}); +});*/ -moveTo(1000,1000)
\ No newline at end of file |
