title: How can I reset my Arduino Micro when I've accidentally disabled the internal USB?
body: <p>I think I've hosed up my Arduino Micro.  Now, my Mac doesn't see the serial port at all in the <code>Tools -&gt; Serial Port</code> menu in Arduino 1.0.5.</p>
  
  <p>I believe the culprit was this command that I sent to the MCU:</p>
  
  <pre><code>PORTD = B10000000;
  </code></pre>
  
  <p>More accurately, here is the program that I tried to send and afterwards, I cannot see the MCU at all anymore.</p>
  
  <p>Any advise on how to restore it to factory settings?</p>
  
  <p>Thanks</p>
  
  <pre><code>#define _V0 6   //  V0
  #define _V1 7   //  V1
  
  #define _SYNC       0x00
  #define _BLACK      0x01
  #define _GRAY       0x02
  #define _WHITE      0x03
  
  #define _tvNbrLines             262 /* Includes the last 20 lines for the vertical sync! */
  #define _tvVSyncNbrLines        20  /* These 20 lines... */
  
  #define _ntscDelayHSyncStart    4.7
  #define _ntscDelayBackPorch     6   /* Normally 5.9, but this fixes a timing issue */
  #define _ntscDelayFrontPorch    1.4
  #define _ntscDelayPerLine       51.5
  #define _ntscDelayVSync         58.8
  
  #define _tvPixelWidth           21
  #define _tvPixelHeight          16
  
  void generateVSync(void);
  void writeBufferLine(int position);
  void writeTVLines(void);
  void clearFrameBuffer(void);
  void fillWhiteFrameBuffer(void);
  void fillGrayFrameBuffer(void);
  void fillPatternFrameBuffer(void);
  void loadSprite(void);
  
  byte frameBuffer[_tvPixelWidth][_tvPixelHeight];    // Video frame buffer
  
  void setup() 
  {
  
      pinMode(_V0, OUTPUT); 
      pinMode(_V1, OUTPUT);
      cli();
  }
  
  
  void loop() 
  {
      // writeTVLines();
      writeTest2();
  }
  
  void writeTest2(void) {
  
      int i;
  
      PORTD = B10000000;          // Make the sync high to start with
      for(i=0; i &lt; 5; i++) {
          PORTD = B00000000;      // Sync pulse goes low and delay 2.3 microseconds
          delayMicroseconds(1);
          delayMicroseconds(1);
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
          PORTD = B10000000;      // Sync pulse goes high and delay 29.7 microseconds
          delayMicroseconds(29);
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
       }
  
  
      //
      // Generate the 5 Field Sync Pulses
      //
      for(i=0; i &lt; 5; i++) {
          PORTD = B00000000;      // Sync goes low and delay 27.3 microseconds
          delayMicroseconds(27);
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
          PORTD = B10000000;      // Sync goes high and delay 4.7 microseconds
          delayMicroseconds(1);
          delayMicroseconds(1);
          delayMicroseconds(1);
          delayMicroseconds(1);
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
      }
  
  
      //
      // Generate 5 Narrow Equalization pulses
      //
      for(i=0; i &lt; 5; i++) {
          PORTD = B00000000;      // Sync pulse goes low and delay 2.3 microseconds
          delayMicroseconds(1);
          delayMicroseconds(1);
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
          PORTD = B10000000;
          delayMicroseconds(29);  // Sync pulse goes high and delay 29.7 microseconds
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
      }
  
      // Generate 18 Blank Frames
      for(i=0; i &lt; 18; i++) {
          PORTD = B00000000;      // Pull sync pin low -&gt; 0 volts
          delayMicroseconds(4);
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
          PORTD = B10000000;      // Pull sync pin high
          delayMicroseconds(59);
      }
  
      //   
      // Generate half the Image 
      //
      for(i=0; i &lt; 285; i++) {
          //
          // Front Porch
          // 
          PORTD = B10000000;
          delayMicroseconds(1); // Front Porch: 1.65 microseconds
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
  
          //
          // Generate sync pulse
          //
          PORTD = B00000000;    // Sync pulse pulled low: 4.7 microseconds
          delayMicroseconds(4);
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
  
          //
          // Back Porch
          //
          PORTD = B10000000;    // This is the back porch: 5.6 microseconds.
          delayMicroseconds(5);
          __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
  
          //
          // Drawing starts here: Total time available is 53 microseconds
          //
          PORTD = B10000000;    // Draw black
          delayMicroseconds(20);
          PORTD = B11000000;    // Draw white
          delayMicroseconds(10);
          PORTD = B10000000;    // Draw black
          delayMicroseconds(22);
  
      }
  
  }
  </code></pre>