I recently purchased three different Adafruit Metro Mini 328s (Product Code 2590) and am having a very bizarre problem that I would love some help with.
I've currently uploaded the following program to all three of the Metros:
Code: Select all
int BUTTON = 2;
void setup() {
pinMode(BUTTON, INPUT);
Serial.begin(9600);
}
void loop() {
if(digitalRead(BUTTON)==HIGH){
Serial.println('D');
delay(10);
}
}
After uploading the code, and without pressing anything on my breadboard, the top LED starts flashing (I assume indicating that it is transmitting) and it starts printing "D" to the serial console repeatedly. Assuming I had a short in my breadboard, I removed the metro from the breadboard and reset it, only to find the same exact thing occur again. Thinking I must have just soldered the headers wrong somehow, I tried with the second, and then third Metro, only to find the same thing. When a program is uploaded and the board is moved/touched it immediately starts printing "D" to the serial console as if a button were pressed. This is despite the fact that this occurs without even being mounted in a breadboard and with no external connections whatsoever. I've tried two different USB cables as well as touching it with my fingers, the sleeve of my sweater, and even the page of a book, but they will all either initiate the program to print "D" to the serial console, or to stop the printing depending on the angle that the Metro was touched. Please help, as I am absolutely baffled. Surely I can't have shorted all three boards in the same way to cause the same error, right?