Issue with ACDC adapter after uploading program

Hello, I am finishing a project for a gas sensor + buzzer.

I test my sensor on site, calibrate with the USB port power.
After I am done I use my stationary ACDC Adapter for arduino, but the arduino won't stay ON.

I tested with another arduino same result, so I suspect it's the coding ??

Steps:
testing ACDC Adapter with new arduino without code (blank) - BOOTING, POWER ON, OK
Uploading Code, inserting Adapter while the USB is in the Arduino (or not both tried) - NOT Booting, light blink once and the unit won't stay on.

Any clues?

Thanks

/* Testing MQ-2 GAS sensor with serial monitor
   Suitable for detecting of LPG, i-butane, propane, methane ,alcohol, Hydrogen or smoke
   More info: http://www.ardumotive.com/how-to-use-mq2-gas-sensor-en.html
   Dev: Michalis Vasilakis // Date: 11/6/2015 // www.ardumotive.com                     */

const int gasPin = A0; //GAS sensor output pin to Arduino analog A0 pin


//Example code KY012 active buzzer
int speakerPin =8;


void setup () {
  pinMode (speakerPin, OUTPUT);
  Serial.begin(9600); //Initialize serial port - 9600 bps
}



void loop () {

  int gasSensorValue = analogRead(gasPin); // read sensor

  if (gasSensorValue > 70) {
    analogWrite (speakerPin, 255);  // Do an off-on pattern starting with off
    delay (500);
    analogWrite (speakerPin, 0);
    delay (10);
  } else {        // Shut the buzzer
    analogWrite (speakerPin, 255);

  }

  Serial.println(gasSensorValue);
  delay(500);
}

testing ACDC Adapter with new arduino without code (blank)

Actually it probably had the Blink sketch pre loaded.

What happens if you load a simple sketch such as Blink and try the different power sources ? Disconnecting the USB before connecting an external supply would be best. I assume that you are sure that the external supply is actually providing 12V

My power supply is only feeding 9v. Is that a problem?

Thanks

I swaped the PS. Looks like a faulty PS this time.
It's 9v.

My power supply is only feeding 9v. Is that a problem?

That should not be a problem as long as the voltage is maintained under load.

I don't know why I thought that your adaptor was providing 12V. Sorry for the confusion.

Is everything working OK with the replacement PSU ?

Yes the PSU looks good thanks.

I posted the complete project here.
http://forum.arduino.cc/index.php?topic=469925.0

Yes the PSU looks good thanks.

Throw the faulty one away NOW if you haven't already done so !