-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Description
Hardware
Hardware: NodeMCU v2
Core Version: Latest GIT
Description
Problem description
Settings in IDE
Module: NodeMCU
Upload Using: SERIAL
Reset Method: nodemcu
Sketch
#include "DHT.h"
#define DHTTYPE DHT22
#define DHTPIN D9 // D9 is Serial RX
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200);
dht.begin();
}
void loop() {
Serial.println(dht.readTemperature());
}
This is a stripped version of my code, which just describes the question.
I would like to use pin D9 for DHT (input), because I only use Serial for debugging output.
Is it possible to begin Serial with some parameter so it will only use it's TX pin and leave the RX pin free/available for other usage?
I do see this in the uart.h file, but I really don't know if/how I could make use of those:
#define UART_FULL 0
#define UART_RX_ONLY 1
#define UART_TX_ONLY 2
#define UART_TX_FIFO_SIZE 0x80
struct uart_;
typedef struct uart_ uart_t;
uart_t* uart_init(int uart_nr, int baudrate, int config, int mode, int tx_pin, size_t rx_size);
void uart_uninit(uart_t* uart);
void uart_swap(uart_t* uart, int tx_pin);
void uart_set_tx(uart_t* uart, int tx_pin);
void uart_set_pins(uart_t* uart, int tx, int rx);
bool uart_tx_enabled(uart_t* uart);
bool uart_rx_enabled(uart_t* uart);
Metadata
Metadata
Assignees
Labels
No labels