HelTecAutomation / Heltec_ESP32

Arduino library for Heltec ESP32 (or ESP32+LoRa) based boards
Other
581 stars 219 forks source link

UART 1 Doesn't transmit/receive - WiFi LoRa32 V3 #141

Open Frosty-STI opened 2 months ago

Frosty-STI commented 2 months ago

Hi, I'm following the example Serial2.ino, and I've slightly modified it to allow one of my V3s to be a transmitter, and one to be a receiver. I am neither transmitting nor receiving, however. How am I supposed to access UART1 on pins 2/17??

Sender code: /*

void setup() { Serial.begin(115200);

// Serial1.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) // Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) // The txPin & rxPin can set to any output pin

Serial1.begin(115200, SERIAL_8N1, 2, 17); // Serial2.begin(115200, SERIAL_8N1, 22, 23); }

void loop() { //Serial.println("Serial not online"); delay(5000); if(Serial1.available()) {

Serial1.write(8);
for(int i = 0; i<30;i++){
  Serial.println("DEVICE FOUND");

}

}

// if(Serial2.available()) { // int ch = Serial2.read(); // Serial2.write(ch); // }

// if(Serial2.available()) { // int ch = Serial2.read(); // Serial.write(ch); // } }

Receiver code: /*

void setup() { Serial.begin(115200);

// Serial1.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) // Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) // The txPin & rxPin can set to any output pin

Serial1.begin(115200, SERIAL_8N1, 2, 17); // Serial2.begin(115200, SERIAL_8N1, 22, 23); }

void loop() { //Serial.println("Serial not online"); delay(5000); if(Serial1.available()) { int ch = Serial.read(); for(int i = 0; i<100; i++) Serial.print(ch); }

if(Serial2.available()) { int ch = Serial2.read(); Serial2.write(ch); }

if(Serial2.available()) { int ch = Serial2.read(); Serial.write(ch); } }

Any help is appreciated, thank you!!!!