HI,
I'm trying to get the native usb running along with the uart. The goal is to get the "regular" Serial to read/write data and then Write read data to the usb.
Basically forwarding data from the serial monitor to the USB and back.
I'm not so sure everything is working, so i would appreciate any help in explaining the things that should be done (and i might not did) Thanks.
The ESP should be in the OTG mode of course.
#include <Arduino.h>
#include <Wifi.h>
#include "USB.h"
void setup() {
// put your setup code here, to run once:
// pinMode(LED_IO1, OUTPUT);
Serial.begin(115200);
Serial.println("This is the PC test");
Serial.println("Test Begin");
// USB Communication init
SerialUSB.begin(115200);
USB.begin();
}
void loop() {
while (Serial.available()>0) {
char UART_Data_IN = Serial.read();//Read_UART0 ();
SerialUSB.write(ART_Data_IN);
}//if
while (SerialUSB.available()) {
char hex[3];
hex[0] = SerialUSB.read();
hex[1] = SerialUSB.read();
hex[2] = '\0';
long byteRead = strtol(hex, NULL, 16);
Serial.write(byteRead);
}
}
The uart to USB is on com 4 and the usb is on com7. the problem is that i cant open the regular terminal even though it should be on com4, it says there's a probelm with com7. Any way i can configure that ? or understand what the problem is?
If it helps, i'm using VSCode with platformIO
Thanks,