I am using arduino uno to make a sound detector. I uploaded a program, found error in the code that it returns unintended numbers unreasonably big. I also think I used wrong code for the module, but it was connected in the way that can work properly with the proper code.

The code I uploaded was:

const int ledPin =13;
const int middleValue = 512;
const int numberOfSamples =128;

int sample;
long signal;
long averageReading;

long runningAverage = 0;
const int averagedOver = 16;

const int threshold=400;

void setup(){
    pinMode(ledPin, OUTPUT)

void loop(){
    long sumOfSquares = 0;
    for (int i=0; i<numberOfSamples; i++){
        sample = analogRead(0);
        signal = (sample - middleValue);
        signal *= signal;
        sumOfSquares += signal;
    averageReading = sumOfSquares/numberOfSamples;
    runningAverage=(((averagedOver -1 )*runningAverage)+averageReading)/averagedOver;

        digitalWrite(ledPin, HIGH);
        digitalWrite(ledPin, LOW);

When the arduino suddenly stopped sending serial numbers, I pressed reset button and uploaded the default code:

void setup() {

void loop() {

but now it shows that it cannot connect to COM3 (arduino) and cant find the device, When I can see arduino uno successfully connected to PC using device manager (windows 8.1). The led light of arduino also turns on when I connect it to power source or usb.

it shows "port not found" when I click to see the serial output

Did I just fry Arduino? How should I fix this?

Also, i checked the led pin 13 blinking three times when i plug in the usb. I just cant upload anything

3 Answers 3


You might have your serial monitor open at COM3 somewhere which is why AVRdude is failing to open the port again. Make sure the serial monitor is closed.

if you are opening serial ports on Python or your own developed applications, you have to explicitly close the port on exiting the program, otherwise, the port remains open and you come across such errors.


I ran into such a problem when I was accessing my Arduino board from two different windows applications like Arduino IDE and eclipse. or Eclipse and some serial monitor windows application. Make sure you close any application that programs or communicates with the Arduino board, and make sure you configure the COM you are using in Arduino IDE and try again. Also try disconnecting any wire that is connected to RX and TX pins when you are programming the Arduino.


my arduino revived the next day.... don't know why but it works!

Not the answer you're looking for? Browse other questions tagged or ask your own question.