# too few arguments to function error\[SOLVED\]

**URL:** <https://forum.arduino.cc/t/too-few-arguments-to-function-error-solved/568698>\
**Category:** Programming\
**Created:** [January 19, 2019, 10:38pm UTC](https://forum.arduino.cc/t/too-few-arguments-to-function-error-solved/568698 "2019-01-19T22:38:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allspice101](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/allspice101/32/327548_2.png) [@Allspice101](https://forum.arduino.cc/u/Allspice101)\
**Post date:** [January 19, 2019, 10:38pm UTC](https://forum.arduino.cc/t/too-few-arguments-to-function-error-solved/568698/1 "2019-01-19T22:38:42Z")

</div>

I am having an issue with my code. The ide keeps saying: too few arguments to function 'void digitalWrite(uint8\_t, uint8\_t)'.

My code is:

```cpp
int red = 3;
int yellow = 5;
int green = 8;

int blue = 13;

int activate = 7;

void setup() {
  // put your setup code here, to run once:
  pinMode(activate, INPUT_PULLUP);
  pinMode(red, OUTPUT);
  pinMode(yellow, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(green, OUTPUT);
 }

void loop() {
  // put your main code here, to run repeatedly:
  if (digitalRead(activate) == HIGH)
  {
    digitalWrite(green) == LOW);
    digitalWrite(yellow) == HIGH);
    delay(3000);
    digitalWrite(yellow) == LOW);
    digitalWrite(red) == HIGH);
  }
  else if (digitalRead(activate) == LOW)
  { 
  digitalWrite(green) == HIGH);
  digitalWrite(blue) == LOW);
  digitalWrite(red) == LOW);
  digitalWrite(yellow) == LOW);
  }
}

```

I am using the UNO board

I am using 5 led's(one red, one yellow, one green, two blue), five 220ohm resistors(one per LED), and one button.

Pin setup:  
the two blue led's to pin 13  
red led to pin 3  
yellow led topin 5  
green led to pin 8  
button(activate in code) to pin 7

Did i code it wrong? Does anybody know the solution? I tried the else if as an if function already.

(For fun, I atached the blue led's to pin D13 to see the board led blink [Uno prototype shield atached.])

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [January 19, 2019, 10:44pm UTC](https://forum.arduino.cc/t/too-few-arguments-to-function-error-solved/568698/2 "2019-01-19T22:44:52Z")

</div>

Go to the C++ reference section to see if you are doing this correctly:

digitalWrite(green) == LOW);

> **[Arduino Reference - Arduino Reference](https://www.arduino.cc/reference/en/)**
>
> The Arduino programming language Reference, organized into Functions, Variable and Constant, and Structure keywords.

---

<div class="post-metadata">

**Author:** ![Paul\_KD7HB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_kd7hb/32/1127958_2.png) [@Paul\_KD7HB](https://forum.arduino.cc/u/Paul_KD7HB)\
**Post date:** [January 19, 2019, 10:45pm UTC](https://forum.arduino.cc/t/too-few-arguments-to-function-error-solved/568698/3 "2019-01-19T22:45:14Z")

</div>

Look at the syntax of the function: Syntax

digitalWrite(pin, value).

Does that look like what you have?

Paul

---

<div class="post-metadata">

**Author:** ![Allspice101](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/allspice101/32/327548_2.png) [@Allspice101](https://forum.arduino.cc/u/Allspice101)\
**Post date:** [January 19, 2019, 10:50pm UTC](https://forum.arduino.cc/t/too-few-arguments-to-function-error-solved/568698/4 "2019-01-19T22:50:33Z")

</div>

> larryd:  
> Go to the C++ reference section to see if you are doing this correctly:
> 
> digitalWrite(green) == LOW);
> 
> [Arduino Reference - Arduino Reference](https://www.arduino.cc/reference/en/)

> larryd:  
> Go to the C++ reference section to see if you are doing this correctly:
> 
> digitalWrite(green) == LOW);
> 
> [Arduino Reference - Arduino Reference](https://www.arduino.cc/reference/en/)
> 
> Thanks larryd, i didn't catch that.

---

<div class="post-metadata">

**Author:** ![catman22](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@catman22](https://forum.arduino.cc/u/catman22)\
**Post date:** [May 21, 2020, 10:55pm UTC](https://forum.arduino.cc/t/too-few-arguments-to-function-error-solved/568698/5 "2020-05-21T22:55:11Z")

</div>

i tried that, but it did not work. here is my work:

int green = 9;  
int yellow = 10;  
int red =11;  
int motor = 3;

void setup() {  
pinMode(green, OUTPUT);  
pinMode(yellow, OUTPUT);  
pinMode(red, OUTPUT);  
pinMode(motor, OUTPUT);  
}

void loop() {  
pinMode(green) == LOW);  
pinMode(yellow) == LOW);  
pinMode(red) == LOW);  
pinMode(motor) == LOW);  
pinMode(green) == HIGH);  
delay(500);  
pinMode(yellow) == HIGH);  
pinMode(red) == HIGH);  
pinMode(motor) == HIGH);  
}

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 11:35pm UTC](https://forum.arduino.cc/t/too-few-arguments-to-function-error-solved/568698/6 "2021-05-05T23:35:21Z")

</div>

Closed on May 5, 2021, 11:35pm UTC


