mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Wait for serial port to connect in example - needed for Leonardo, Teensy and other boards with built-in USB CDC serial connection
This commit is contained in:
parent
d20ae89818
commit
f8c0adc107
34 changed files with 35 additions and 1 deletions
|
@ -19,6 +19,7 @@ boolean printAngle;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -23,6 +23,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -28,6 +28,7 @@ String output = ""; // We will store the data in this string
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200); // This wil lprint the debugging from the libraries
|
Serial.begin(115200); // This wil lprint the debugging from the libraries
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -18,6 +18,7 @@ boolean firstMessage = true;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -20,6 +20,7 @@ void setup() {
|
||||||
SerialBT[i] = new SPP(&Btd); // This will set the name to the default: "Arduino" and the pin to "1234" for all connections
|
SerialBT[i] = new SPP(&Btd); // This will set the name to the default: "Arduino" and the pin to "1234" for all connections
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -18,6 +18,7 @@ bool printAngle;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -30,6 +30,7 @@ uint8_t printObjects;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -23,6 +23,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -16,6 +16,7 @@ WII Wii(&Btd,PAIR); // This will start an inquiry and then pair with your Wiimot
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -101,6 +101,7 @@ KbdRptParser Prs;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -148,6 +148,7 @@ MouseRptParser MousePrs;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -55,6 +55,7 @@ MouseRptParser Prs;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -12,6 +12,7 @@ JoystickReportParser Joy(&JoyEvents);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -51,6 +51,7 @@ UniversalReportParser Uni;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -15,6 +15,7 @@ JoystickReportParser Joy(&JoyEvents);
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -17,6 +17,7 @@ ScaleReportParser Scale(&ScaleEvents);
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -16,6 +16,7 @@ uint8_t state = 0;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -45,6 +45,7 @@ void PrintAddress(uint8_t addr)
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -13,6 +13,7 @@ XBOXOLD Xbox(&Usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); // halt
|
while(1); // halt
|
||||||
|
|
|
@ -12,6 +12,7 @@ XBOXRECV Xbox(&Usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -11,6 +11,7 @@ XBOXUSB Xbox(&Usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
|
|
|
@ -43,6 +43,7 @@ ACM Acm(&Usb, &AsyncOper);
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -15,12 +15,13 @@ ADK adk(&Usb,"TKJElectronics", // Manufacturer Name
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.print("\r\nADK demo start");
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
Serial.print("\r\nOSCOKIRQ failed to assert");
|
Serial.print("\r\nOSCOKIRQ failed to assert");
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
}
|
}
|
||||||
pinMode(LED, OUTPUT);
|
pinMode(LED, OUTPUT);
|
||||||
|
Serial.print("\r\nArduino Blink LED Started");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
|
|
@ -64,6 +64,7 @@ KbdRptParser Prs;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("\r\nADK demo start");
|
Serial.println("\r\nADK demo start");
|
||||||
|
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ void init_leds()
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("\r\nADK demo start");
|
Serial.println("\r\nADK demo start");
|
||||||
|
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ ADK adk(&Usb,"Circuits@Home, ltd.",
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("\r\nADK demo start");
|
Serial.println("\r\nADK demo start");
|
||||||
|
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ ADK adk(&Usb,"Circuits@Home, ltd.",
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("\r\nADK demo start");
|
Serial.println("\r\nADK demo start");
|
||||||
|
|
||||||
if (Usb.Init() == -1) {
|
if (Usb.Init() == -1) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ USB Usb;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
E_Notify(PSTR("\r\nCircuits At Home 2011"),0x80);
|
E_Notify(PSTR("\r\nCircuits At Home 2011"),0x80);
|
||||||
E_Notify(PSTR("\r\nUSB Host Shield Quality Control Routine"),0x80);
|
E_Notify(PSTR("\r\nUSB Host Shield Quality Control Routine"),0x80);
|
||||||
/* SPI quick test - check revision register */
|
/* SPI quick test - check revision register */
|
||||||
|
|
|
@ -38,6 +38,7 @@ uint32_t next_time;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -41,6 +41,7 @@ void PrintAddress(uint8_t addr)
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -46,6 +46,7 @@ PL2303 Pl(&Usb, &AsyncOper);
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -49,6 +49,7 @@ uint32_t read_delay;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
|
@ -64,6 +64,7 @@ void setup()
|
||||||
{
|
{
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
|
|
||||||
Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version());
|
Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version());
|
||||||
Serial.println("by Mikal Hart");
|
Serial.println("by Mikal Hart");
|
||||||
|
|
|
@ -46,6 +46,7 @@ PL2303 Pl(&Usb, &AsyncOper);
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (Usb.Init() == -1)
|
||||||
|
|
Loading…
Reference in a new issue