How to use USB serial? usb_init() not defined

Status
Not open for further replies.

JasonH

Member
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?
 
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
 
Status
Not open for further replies.
Back
Top