Skip to content

Leonardo: constructor with delay knocks out serial port #6277

Closed
@Koepel

Description

@Koepel

In a forum in the Netherlands, someone encountered a possible bug: http://arduinoforum.nl/viewtopic.php?f=13&t=2533.
I can replicate the problem in Windows 10 and Ubuntu linux 17.04 with Arduino IDE 1.8.1 and 1.8.2 and with the Leonardo bootloader that came with version 1.6.8 and 1.8.2.

Below is a test sketch. After uploading, the serial port disappears and uploading once more is not possible. The delay() is needed and the parameter for the constructor is needed.

There is a workaround to be able to upload a sketch. I turn on the verbose output for upload in the preferences and when the Arduino IDE tries to upload then I press the reset button on the Arduino board.

class myLibT
{
  public:
    myLibT( char a);
};

myLibT::myLibT( char a) 
{
  delay(10);     // This delay together with the parameter kills the usb-serial.
}

myLibT serialwrecker( 0);   // the parameter is needed

void setup() 
{
}

void loop() 
{
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Architecture: AVRApplies only to the AVR microcontrollers (Uno, etc.)Type: BugUSB: CDC serialSerial interface used by MCUs with native USB (e.g. Leonardo) to communicate with the computer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions