Current Lua downloadable firmware will be posted here

User avatar
By beetlejuice76
#33129 Hi,

My first post here :)

I didn't find the answer on the forum or anywhere else, hope someone can help.

So I have an NodeMCU with an ultrasonic sensor that can communicate through UART (TTL).

Now, my problem is twofolds:
1) should I connect the UART from my sensor to GPIO 1&3 (TXD0, RXD0) or GPIO 13-15 (TXD2, RXD2) ?
2) I actually tried both, but I don't get anything on my NodeMCU: uart.on() is never called. I know that I should get something, because a) it works with an Arduino, and b) if I connect the sensor to another GPIO, I do see signal changes (0-1- etc). I was thinking that maybe the USB-TTL converter of the NodeMCU is prevailing, but in this case I don't understand those samples:

uart.on("data", 4,
function(data)
print("receive from uart:", data)
if data=="quit" then
uart.on("data")
end
end, 0)

ie how can print and uart.on work together

Finally, if I write on UART, the output comes on my ESPLORER IDE, hence my suspicion of the USB-TTL prevailing.
User avatar
By ArtWhaley
#33240 I'm also new to the nodeMCU and the forum, but I can confirm from the schematic https://raw.githubusercontent.com/nodem ... IT_SCH.png that UART0 is connected to the USB interface... though I can't understand why you wouldn't receive information there just because the pin is shared?

And according to the nodeMCU documentation... only one UART is currently supported by the firmware? I assume because there are another UART and a half on the board that you could access them by writing native code, or maybe exploring the arduino IDE libraries? But that's wild speculation, I haven't done the research yet! Let us know what you find!
User avatar
By bubba198
#35124 Very true, "another UART and a half on the board" and I was interested to access the "half" UART since that's where the other blue LED is connected to but all I could figure out how to do was turn the PIN into a GPIO and then control its state but I was NOT able to send data to that UART no matter what I did.

This maybe just a defect in the firmware...