Post your best Lua script examples here

User avatar
By jclmdt
#61404 Hi, thanks for the reply.

I am currently running on the '0.9.6-dev_20150627' firmware, as I watched videos online that says to download the dev firmware to flash. I know that there are newer ones call 'master' but I do not know how to flash such file in the chip. It seems to be some build your own firmware (?) thing, which I have no idea what to do with it.

Could you kindly guide me on this so that I can have the newer firmware that supports the uart.alt(1) command and try out your suggestion. Your help is greatly appreciated!

Cheers.
User avatar
By OM1
#81159 Hi there, I joined this forum because I got stuck in a similar problem.

I have nodeMCU ESP12. I try to read UART input at pin D7, 4800 bps.
(Data will be transmitted via WiFi, already working.)

My code:
uart.setup(1, 4800, 8, uart.PARITY_NONE, uart.STOPBITS_2, 1)
uart.alt(1) -- switch to pin D7 für RX
tmr.alarm(2, 500, tmr.ALARM_SINGLE, function() end) -- delay
uart.on("data", 1, function(data)
tmr.alarm(2, 500, tmr.ALARM_SINGLE, function() end -- delay
gpio.write(LED_PIN, gpio.LOW) -- blink indicates RX input
D=D..string.byte(data)
end, 0)

I have set D7 to
gpio.mode(7,gpio.INT)

I can see the LOW-RX with the oscilloscope, and the LED blinks, but no RX-input.
I have read in German and English manual contradictory statements.
I have read many many snippets an proposals, but did not find a solution for this problem.

My status / my questions:
Can I use D7 as UART-RX ?
Are there different solutions, RX-input connected to pin RX, code like this:
uart.alt(0)
uart.setup(0, 4800, 8, uart.PARITY_NONE, uart.STOPBITS_2, 1)

Any experience with ESP32? Tried but no success.
Any success with I2C-UART: SC16IS750? Tried but no success.

A WORKING sample for this issue would be great!
I hope anybody has experience with ESP8266-UART. - Thank you very much!
OM1