Problem with Gas Sensor (MQ2) -> serial Port exception


#1

Hi all

We are using Arduino 2 to connect to our Gas Sensor (MQ2). The sensor is connected to port A0 as described in https://seeeddoc.github.io/Grove-Gas_Sensor-MQ2/

Using the following script:

void setup() {
  Serial.begin(9600);
}
 
void loop() {
  float sensor_volt; 
  float sensorValue;
 
  sensorValue = analogRead(A0);
  sensor_volt = sensorValue/1024*5.0;
 
  Serial.print("sensor_volt = ");
  Serial.print(sensor_volt);
  Serial.println("V");
  delay(1000);
}

Leeds to the this error:

Binary sketch size: 1,082 bytes (of a 32,256 byte maximum)
processing.app.SerialNotFoundException: Serial port 'COM1' not found. Did you select the right one from the Tools > Serial Port menu?
   at processing.app.Serial.<init>(Serial.java:191)
   at processing.app.Serial.<init>(Serial.java:77)
   at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)
   at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:175)
   at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
   at processing.app.Sketch.upload(Sketch.java:1666)
   at processing.app.Sketch.exportApplet(Sketch.java:1622)
   at processing.app.Sketch.exportApplet(Sketch.java:1594)
   at processing.app.Editor$DefaultExportHandler.run(Editor.java:2382)
   at java.lang.Thread.run(Thread.java:619)

Any hints?
Thx a lot, Thomy


#2

You either haven’t selected the right port for your embedded device or you don’t have any embedded devices connect to your machine.