zeroday wrote:gpio1 and gpio3 are rx/tx. the default function of these 2pins is uart.
gpio module can use these 2 pins as general io pins, gpio.mode(..)
the issue is, when these pins set as gpio. it works as gpio.
but if you want to set these pins again in uart mode(uart.setup). it failed.
it stays in gpio mode (rx pin). issue 18
Ok, I did not know that redefinition of TX/RX as GPIO line was already possible.
If you do not need the UART, you can use 4 GPIO lines (GPIO0, GPIO1/RX, GPIO2, GPIO/TX).
Correct?
So this would be a good example?
-- define the TX line as general GPIO output line
gpio.mode(4,gpio.OUTPUT)
-- set the TX line to HIGH
gpio.write(4,gpio.HIGH)
-- define the RX line as general GPIO input line
gpio.mode(5,gpio.INPUT)
-- read the level of the RX line
level=gpio.read(5)
-- setup the uart AND set TX and RX to their original uart function, 9600 8N1 ECHO
-- API doc says "echo = 0(close echo back)."
uart.setup( 0, 9600, 8, 0, 1, 1 )
-- or is it?
uart.setup( 0, 9600, 8, 0, 1, 0 )
Correct?