lua - 无法读取 NodeMCU 上的串行/UART 引脚

标签 lua nodemcu

我无法在 NodeMCU Lua 环境中读取串行引脚。我只能读取USB串口。

我已将串行适配器连接到 rx、tx 和 g 引脚。

我尝试过这段代码:

uart.on("data","\n",function(data) print("receive from uart:", data) end, 0)

我在 ESplorer 控制台中输入文本,它确实读取了该文本。它不会读取我通过插入 rx/tx/g 引脚的串行适配器发送的任何内容。


uart.write(0, "hello")

我断开了 USB 电缆并使用串行适配器为其供电。使用此代码未发送任何内容。我尝试了uart.write(0,uart.write(1,


如何读取pin串口而不是usb串口?

最佳答案

我需要拔掉 USB 电缆。如果插入 USB 电缆并且您尝试使用 pin 串行端口,设备会感到困惑。

请参阅我在 esp 论坛上的问题: https://www.esp8266.com/viewtopic.php?f=22&t=19768

关于lua - 无法读取 NodeMCU 上的串行/UART 引脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56203024/

相关文章:

c++ - 使用 Sol2 将 LUA 序列安全地传递给 C++

esp8266 - 如何让nodemcu在连接到ESP8266 AP时弹出浏览器窗口?

arduino - 使用 NodeMCU ESP8266 发送 GET 请求

Lua忽略范围变量

eclipse - 防止 Lua 表中的函数重写

multithreading - 在多线程程序中嵌入多个 lua 实例

apache - 无法从 mod_lua 连接到 postgresql

ssl - 使用 HTTPS 与 Nodemcu 断开连接

ssl - nodeMCU TLS 证书错误

algorithm - 节省内存的归并排序