COM Port disappears. Trick doesn't work.

I have an M0 which is my first Arduino. I had a program working on it that would toggle a DO channel given an AI channel value. I wanted to add some diagnostics so I added serial communication to my program, and it seems as though I've bricked the M0. I have tried the reset trick several times using the Blink sketch. In some cases it says upload complete. In most cases it fails to upload. In all cases nothing changes. The serial port disappears in Device Manager and I can't reprogram this thing.

Rx light solid.
Tx light never blinks.
L light blinks during loading
ON light solid.

  1. How can I get it back?
  2. How can I avoid this in the future?

Post the code that you think bricked the board. Post the error messages. Please use code tags for these.

Btw, the MO is not an arduino.cc board, its from arduini.org.

I don’t know the difference. :-*

I added the Serial.begin and Serial.println statements for diagnostics. How should I handle closing the port so that it isn’t taken automatically when I run? I have a Leonardo now and I don’t want to brick it too. :slight_smile:

int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor

void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
// turn the ledPin on
digitalWrite(ledPin, HIGH);
// stop the program for milliseconds:
delay(sensorValue);
// turn the ledPin off:
digitalWrite(ledPin, LOW);
// stop the program for for milliseconds:
delay(sensorValue);
}

Arduino.org was the old Arduino manufacturer. They went rogue, stopped contributing to the real Arduino and pocketing the money themselves, and started insisting that they were the real Arduino. Litigation is ongoing. There's more information on this shitstorm around the web.

I think the M0 is a copy of the Arduino Zero?

So beyond the politics, if I write a sketch that uses the serial port, how can I make sure that it doesn't get stuck in this program and keep me from connecting via USB to reprogram even after resetting it?

Now I have a Leonardo but it seems as though this is also an Arduino.org board.