Device no longer recognised by Win7 after upload - SOLVED

The board is a micro clone. When new it shows up in the IDE as Genuino Micro.

I can't remember exactly what I did, but I now have two of these not working. In Win7 device manager they are unknown device. The RX LED is on solid.

With the first one that got screwed up. I was loading a sketch I haven't used before. And I'm not sure if board was set to Genuino or Leonardo.

Pretty sure on the 2nd one I uploaded the same sketch with board set to Leonardo. That got screwed too.

3rd time. An old trusted sketch. Board set to Genuino. All OK.

So my questions are:

Can I reset/save my boards? If I can then I can experiment to answer my other questions.

Did having the board set wrong, cause this problem?

Can a bad sketch cause this sort of problem? I can upload the sketch if that a possible cause. I noticed that the code tries to index into a structure that's not big enough.


So I solved this.

To reset my boards. Hold reset down until uploader is looking for a COM port. That fixed it.

Setting board to Genuino Micro or Leonardo both appear to work successfully for uploading. I don't know if some pins might be missed numbered with one or the other, need to check this.

The lockup was caused by an error in the sketch. The code indexed into a structure that wasn't as big as the index. Whatever value got returned by that was used for thing like setting a pin as pullup input, and digitalread to that value. I'll be more careful next time.