user38869: Board: Arduino Leonardo
IDE version: 1.6.5(also tried with 1.8.3)
Try Arduino Web Editor as well
The problem: after connecting Arduino to PC via USB in 5-7 seconds IDE says that connection is losted.
Everything was OK, but after one deploy happened thing, that I described.
If it help: I connect OLED display and use it with OLED_I2C library. Sketch contains one cpp and one h file.
I'm already fully reinstall USB drivers with Arduino USB as well

user4143: 
The problem: after connecting Arduino to PC via USB in 5-7 seconds IDE says that connection is losted.

Yes, that's normal. That's the bootloader running, and it's during that 5-7 second window that you can upload a new sketch.
Under normal circumstances the IDE will automatically reboot the board for you so the upload time window coincides with the IDE's attempt to upload a new sketch. However under some circumstances it can't, so you have to do it manually by pressing the reset button at the right time.
Also on Windows you may find that you have a different COM port for programming as you do when a sketch is running (Windows is retarded like that, you see). The IDE tries to do some magic to identify the correct COM port to use, but you have to first have the correct "sketch mode" COM port selected so it can first reboot the board into the bootloader, at which point it tries to do its magic to work out the correct COM port to use by looking to see which COM port (if any) has just appeared since rebooting.
So, in short: if the IDE can't reboot the board for you then do it manually, but note that timing is vital. Press the reset button a few moments before avrdude runs. It may take practice.

38869: <p><strong>Board</strong>: Arduino Leonardo</p>

<p><strong>IDE version</strong>: 1.6.5(also tried with 1.8.3)</p>

<p>Try <strong>Arduino Web Editor</strong> as well</p>

<p>The problem: after connecting Arduino to PC via USB in 5-7 seconds IDE says that connection is losted.</p>

<p>Everything was OK, but after one deploy happened thing, that I described.</p>

<p>If it help: I connect OLED display and use it with OLED_I2C <a href="http://www.rinkydinkelectronics.com/resource/OLED_I2C/OLED_I2C.pdf" rel="nofollow noreferrer">library</a>. Sketch contains one <code>cpp</code> and one <code>h</code> file.</p>

<p>I'm already fully reinstall USB drivers with Arduino USB as well</p>
 4143: <blockquote>
  <p>The problem: after connecting Arduino to PC via USB in 5-7 seconds IDE says that connection is losted.</p>
</blockquote>

<p>Yes, that's normal. That's the bootloader running, and it's during that 5-7 second window that you can upload a new sketch.</p>

<p>Under normal circumstances the IDE will automatically reboot the board for you so the upload time window coincides with the IDE's attempt to upload a new sketch. However under some circumstances it can't, so you have to do it manually by pressing the reset button at the right time.</p>

<p>Also on Windows you may find that you have a different COM port for programming as you do when a sketch is running (Windows is retarded like that, you see). The IDE tries to do some magic to identify the correct COM port to use, but you have to first have the correct "sketch mode" COM port selected so it can first reboot the board into the bootloader, at which point it tries to do its magic to work out the correct COM port to use by looking to see which COM port (if any) has just appeared since rebooting.</p>

<p>So, in short: if the IDE can't reboot the board for you then do it manually, but note that <em>timing is vital</em>. Press the reset button a few moments <em>before</em> <code>avrdude</code> runs. It may take practice.</p>
