diff options
| -rw-r--r-- | .vscode/extensions.json | 13 | ||||
| -rw-r--r-- | .vscode/launch.json | 15 | ||||
| -rw-r--r-- | .vscode/settings.json | 7 | ||||
| -rw-r--r-- | index.html | 2 | ||||
| -rw-r--r-- | index.js | 2 | ||||
| -rw-r--r-- | robot.js | 20 | ||||
| -rw-r--r-- | robot/main.py | 4 |
7 files changed, 50 insertions, 13 deletions
diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..f8f1a44 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,13 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "lego-education.ev3-micropython" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [ + "ms-python.python" + ] +}
\ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d933aeb --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Download and Run", + "type": "ev3devBrowser", + "request": "launch", + "program": "/home/robot/${workspaceRootFolderName}/main.py", + "interactiveTerminal": false + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b0968c1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +// Place your settings in this file to overwrite default and user settings. +{ + "files.eol": "\n", + "debug.openDebug": "neverOpen", + "python.linting.enabled": false, + "python.languageServer": "None" +} @@ -13,6 +13,8 @@ <div id="robot"></div> </canvas> + <script src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script> + <script src="./robot.js"></script> <script src="./index.js"></script> </body> </html> @@ -47,8 +47,8 @@ const drawCross = (x, y) => { canvas.addEventListener('mousedown', (e) => { isPainting = true; - drawCross(e.clientX - canvasOffsetX, e.clientY - canvasOffsetY); + }); /* canvas.addEventListener('mouseup', (e) => { @@ -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 diff --git a/robot/main.py b/robot/main.py index dadde2d..722a533 100644 --- a/robot/main.py +++ b/robot/main.py @@ -29,7 +29,7 @@ get_tick_rate = 0.1 send_tick_rate = 0.5 sensitivity = 400 safe_distance = 150 -ultraSend = [False] +ultraSend = [True] # Functions @@ -70,7 +70,7 @@ ev3.screen.print("Connected") client.set_callback(listen) client.subscribe(MQTT_Topic_Status) time.sleep(0.5) -ev3.screen.print("Listenning...") +ev3.screen.print("Listening...") # Code ############################################################ |
