Hello guys !
I'm new on this forum and beginner in using Espruino. I have some troubles with serial comminication. I'm trying to create a bridge between a TCP and Serial, on the Esp32 board (ESP-WROOM-32).
let net = require('net');
let port = 11000;
Serial2.setup(9600, {
rx: D16,
tx: D17
});
// Create NET server
let server = net.createServer(function (socket) {
socket.on('data', function (datas) {
console.log("TCP RECEIVED:" + datas.toString());
// Send datas from TCP over Serial
Serial2.println(datas.toString());
console.log("SERIAL SEND :" + datas.toString());
});
Serial2.on('data', function (str) {
console.log("SERIAL RECEIVED:" + str.toString());
socket.write(str.toString());
});
});
server.listen(port);
The problem is when the function "Serial2.write(...)" is called, there is no longer a receiving event on "Serial2.on('data',..." when I send data to the serial.
Before the calling, it works perfertly, but after there is no more event.
Is there a function for data events after a write? Or do you have the same problem on your Esp32 with Espruino?
Excuse me for my english, it's not my first language :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hello guys !
I'm new on this forum and beginner in using Espruino. I have some troubles with serial comminication. I'm trying to create a bridge between a TCP and Serial, on the Esp32 board (ESP-WROOM-32).
The problem is when the function "Serial2.write(...)" is called, there is no longer a receiving event on "Serial2.on('data',..." when I send data to the serial.
Before the calling, it works perfertly, but after there is no more event.
Is there a function for data events after a write? Or do you have the same problem on your Esp32 with Espruino?
Excuse me for my english, it's not my first language :)
Hope you can help me