Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 5 months ago.
USBSerial.h include error on NXP LPC800-MAX
Hi all,
I am wondering why 2 weeks ago a piece of code:
- include "LPC8xx.h"
- include "mbed.h"
- include "USBSerial.h"
int main(void) { USBSerial pc(USBTX, USBRX); pc.baud(115200); while(1) { pc.printf("test serial usb"); wait(100); }
return 0; }
compiled and currently it throws an error during compilation: Error: Cannot open source input file "USBSerial.h": No such file or directory in "main.cpp", Line: 3, Col: 23
1 Answer
10 years, 5 months ago.
That first include isn't required, and to include USBSerial you do need the USBDevice repository in your project. However even if you had that included it still wouldn't work: the LPC812 does not support USBSerial. USBSerial is Serial over the USB connection of the target microcontroller, which the LPC812 does not have.
It does have the interface IC which also provides a USB <> Serial bridge. To use that simply use regular Serial. Remove the USBSerial include, and use Serial pc(USBTX, USBRX);.