From 073f6576d9087a89a02730bed7f3196e486ca96a Mon Sep 17 00:00:00 2001 From: liamcottle Date: Tue, 8 Apr 2025 14:28:43 +1200 Subject: [PATCH] update echo bot example --- examples/{tcp_echo_bot.js => echo_bot.js} | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) rename examples/{tcp_echo_bot.js => echo_bot.js} (84%) diff --git a/examples/tcp_echo_bot.js b/examples/echo_bot.js similarity index 84% rename from examples/tcp_echo_bot.js rename to examples/echo_bot.js index 27fbff6..0b0ddd0 100644 --- a/examples/tcp_echo_bot.js +++ b/examples/echo_bot.js @@ -1,14 +1,16 @@ -import TCPConnection from "../src/connection/tcp_connection.js"; import Constants from "../src/constants.js"; +import TCPConnection from "../src/connection/tcp_connection.js"; +import NodeJSSerialConnection from "../src/connection/nodejs_serial_connection.js"; -// create tcp connection -const connection = new TCPConnection("10.1.0.226", 5000); +// create connection +// const connection = new TCPConnection("10.1.0.226", 5000); +const connection = new NodeJSSerialConnection("/dev/cu.usbmodem14401"); // wait until connected connection.on("connected", async () => { // we are now connected - console.log(`Connected to: [${connection.host}:${connection.port}]`); + console.log("Connected"); // send flood advert when connected await connection.sendFloodAdvert();