Forum Rule: Always post complete source code & details to reproduce any issue!
-
How to use USB serial? usb_init() not defined
I did:
#include <usb_serial.h>
RSGPIO: In function 'void setup()':
HRSGPIO:138: error: 'usb_init' was not declared in this scope
usb_init();
^
HRSGPIO: In function 'void loop()':
HRSGPIO:204: warning: comparison between signed and unsigned integer expressions
if (usb_serial_available() >= sizeof(controlPacket)) {
^
'usb_configured' was not declared in this scope
I expected those functions to be defined.
Also I could not find any example code?
-
Senior Member

Originally Posted by
JasonH
Also I could not find any example code?
In Arduino, click File > Examples > 04.Communication > ASCIITable.
Or just do something simple like this to print to the serial monitor
Code:
void setup() {
}
void loop() {
static int count = 0;
Serial.print("Hello World ");
Serial.println(count++);
delay(100);
}
No need to include special headers or worry about low level USB details.
Documentation can be found here:
https://www.pjrc.com/teensy/td_serial.html
-
Haha too easy!
Thanks :facepalm:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules