Arduino build error

error: no matching function for call to 'digitalWrite(int)'

The function exists, but not with the arguments you gave it. There are too few, too many, or one is the wrong type.

  • Build error
  • 3 common causes
  • Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
The message

What the Arduino IDE prints

Output window
sketch.ino: In function 'void setup()':
sketch.ino:4:20: error: no matching function for call to 'digitalWrite(int)'
    4 |   digitalWrite(13);
exit status 1

The notes under the error list the versions that do exist. Compare them with your call.

Mokxi's compiler, clang, words it as too few arguments to function call, or no matching function for call.

Causes

The 3 usual causes with the fix

1Too few arguments

digitalWrite needs the pin and the level. Check the reference for what the call takes.

Broken
void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  digitalWrite(13);
  Serial.println("on");
}

void loop() {
}
Fixed
void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  Serial.println("on");
}

void loop() {
}

Mokxi’s build tab says: digitalWrite is called with values it does not take.

Try this fix in Mokxi

2Your own function is called with the wrong arguments

A function with two parameters cannot be called with one. Add the argument, or give the parameter a default value.

Broken
int add(int a, int b) {
  return a + b;
}

void setup() {
  Serial.begin(9600);
  Serial.println(add(4));
}

void loop() {
}
Fixed
int add(int a, int b = 1) {
  return a + b;
}

void setup() {
  Serial.begin(9600);
  Serial.println(add(4));
}

void loop() {
}

Mokxi’s build tab says: add is called with values it does not take.

Try this fix in Mokxi

3An argument is the wrong type

A text string cannot go where a number is wanted. Convert it first, with a call such as toInt().

Broken
void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  delay("10");
  Serial.println("done");
}

void loop() {
}
Fixed
void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  delay(10);
  Serial.println("done");
}

void loop() {
}

Mokxi’s build tab says: delay is called with values it does not take.

Try this fix in Mokxi

FAQ

Questions and answers

What does "no matching function for call" mean?

No version of that function accepts the arguments you wrote. Count them and check their types.

Where do I see what the function does take?

The lines that start with "note: candidate" under the error list every version. In Mokxi the build tab shows the first one.

Why does it name a type like int in the message?

The message shows the types of the arguments you passed. Compare them with the types in the candidate lines.