Too many arguments

exit status 1

Compilation error: too many arguments to function 'int analogRead(uint8_t)'
here is my code:
#define Sober 200 // Define max value that we consider sober
#define Drunk 400 // Define min value that we consider drunk
#define MQ-3, 0
#define ledPin 6

float sensorValue; //variable to store sensor value

void setup() {
Serial.begin(9600); // sets the serial port to 9600
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
Serial.println("MQ-3, Heating Up!");
delay(20000); // allow the MQ-3 to warm up
}

void loop() {
sensorValue = analogRead(MQ-3); // read analog input pin 0
Serial.print("Sensor Value: ");
Serial.print(sensorValue);
// Return analog moisture value
// Determine the status

if (sensorValue < Sober) {
Serial.println(" | Status: Sober");
} else if (sensorValue >= Sober && sensorValue < Drunk) {
Serial.println(" | Status: Drinking but within legal limits");
} else {
Serial.println(" | Status: DRUNK");
}

unsigned int outputValue = map(sensorValue, 0, 1023, 0, 255);

if (sensorValue > 700) {
analogWrite(ledPin, outputValue); // generate PWM signal
}
else {
digitalWrite(ledPin, LOW);
}

delay(2000); // wait 2s for next reading
}

Thye line the ide has highlighted is sensorValue = analogRead(MQ-3); // read analog input pin 0
first line under Void loop
Any suggestions?

Whats the comma for ?

typo
when removed it says expected ')' before numeric constant

MQ-3 is not a valid macro name. Use MQ_3 instead.
In the end you defined a macro MQ with value -3,0

MQ-3 is not a valid macro name. You can't have a minus sign in the macro name.

Thank you very much that fixed it. Much appreciated
\

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.