What could possibly be wrong with this code?

Please help me. I get an error and I don't know why. This is the error:

In function 'void loop()':

wy_wietlacz:30:20: error: too few arguments to function 'void digitalWrite(uint8_t, uint8_t)'

   if(digitalWrite(5) == LOW) {

                    ^

In file included from sketch\wy_wietlacz.ino.cpp:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.49.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:135:6: note: declared here

 void digitalWrite(uint8_t pin, uint8_t val);

      ^~~~~~~~~~~~

wy_wietlacz:35:6: error: 'else' without a previous 'if'

   }} else {

      ^~~~

wy_wietlacz:36:19: error: too few arguments to function 'void digitalWrite(uint8_t, uint8_t)'

  if(digitalWrite(4) == LOW) {

                   ^

In file included from sketch\wy_wietlacz.ino.cpp:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.49.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:135:6: note: declared here

 void digitalWrite(uint8_t pin, uint8_t val);

      ^~~~~~~~~~~~

wy_wietlacz:41:6: error: 'else' without a previous 'if'

   }} else {

      ^~~~

wy_wietlacz:42:19: error: too few arguments to function 'void digitalWrite(uint8_t, uint8_t)'

  if(digitalWrite(3) == LOW) {

                   ^

In file included from sketch\wy_wietlacz.ino.cpp:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.49.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:135:6: note: declared here

 void digitalWrite(uint8_t pin, uint8_t val);

      ^~~~~~~~~~~~

wy_wietlacz:47:6: error: 'else' without a previous 'if'

   }} else {

      ^~~~

wy_wietlacz:48:21: error: too few arguments to function 'void digitalWrite(uint8_t, uint8_t)'

    if(digitalWrite(2) == LOW) {

                     ^

In file included from sketch\wy_wietlacz.ino.cpp:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.49.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:135:6: note: declared here

 void digitalWrite(uint8_t pin, uint8_t val);

      ^~~~~~~~~~~~

wy_wietlacz:53:6: error: 'else' without a previous 'if'

   }} else {

      ^~~~

exit status 1

too few arguments to function 'void digitalWrite(uint8_t, uint8_t)'
#include <LiquidCrystal.h> //Dołączenie bilbioteki
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); //Informacja o podłączeniu nowego wyświetlacza
#define PIN_YELLOW 6
  #define PIN_GREEN 5
  #define PIN_BLUE 4
  #define PIN_PURPLE 3
  #define PIN_BROWN 2
   
void setup() {
  lcd.begin(16, 2); //Deklaracja typu
  Serial.begin(9600);

    pinMode(PIN_YELLOW, INPUT_PULLUP);
    pinMode(PIN_GREEN, INPUT_PULLUP);
    pinMode(PIN_BLUE, INPUT_PULLUP);
    pinMode(PIN_PURPLE, INPUT_PULLUP);
    pinMode(PIN_BROWN, INPUT_PULLUP);
    delay(200);
}
 
void loop() {
  lcd.begin(16, 2); //Deklaracja typu
  lcd.setCursor(0, 0); //Ustawienie kursora
  if (digitalRead(6) == LOW) {
    lcd.print("       STREAM");
    lcd.setCursor(0, 1);
    lcd.print("    STARTING");
    delay(10000);
  } else {
  if(digitalWrite(5) == LOW) {
    lcd.print("      CHATTING ");
    lcd.setCursor(0, 1);
    lcd.print("   CAMERA");
    delay(10000);
  }} else {
 if(digitalWrite(4) == LOW) {
    lcd.print("    BE        RIGHT");
    lcd.setCursor(0, 1);
    lcd.print("       BACK");
    delay(10000);
  }} else {
 if(digitalWrite(3) == LOW) {
    lcd.print("       STREAM");
    lcd.setCursor(0, 1);
    lcd.print("    ENDING");
    delay(10000);
  }} else {
   if(digitalWrite(2) == LOW) {
    lcd.print("       DISPLAY");
    lcd.setCursor(0, 1);
    lcd.print("        SHARING");
    delay(10000);
  }} else {
    
  lcd.print("1.STARTING"); //Wyświetlenie tekstu
  lcd.setCursor(0, 1); //Ustawienie kursora
  lcd.print("2.CAMERA"); //Wyświetlenie tekstu
  delay(3000);
  lcd.clear(); //Ustawienie kursora
  lcd.print("3.BRB"); //Wyświetlenie tekstu
  lcd.setCursor(0, 1); //Ustawienie kursora
  lcd.print("4.ENDING"); //Wyświetlenie tekstu
  delay(3000);
  lcd.clear(); //Ustawienie kursora
  lcd.print("5.DISPLAY"); //Wyświetlenie tekstu
  lcd.setCursor(0, 1); //Ustawienie kursora
  lcd.print("6.CONCERT"); //Wyświetlenie tekstu
  delay(3000);
}
}
```

digitalWrite() is a void function
You probably want to use digitalRead()

Thank You very much. Sitting at 1 AM got to me. THanks again

Get's everyone. Glad it's fixed.
Happy Programming!

One more question if I may. Do You know what to do so that I don't have to wait each time for the reaction until these lines of code get through:lcd.print("1.STARTING"); //Wyświetlenie tekstu lcd.setCursor(0, 1); //Ustawienie kursora lcd.print("2.CAMERA"); //Wyświetlenie tekstu delay(3000); lcd.clear(); //Ustawienie kursora lcd.print("3.BRB"); //Wyświetlenie tekstu lcd.setCursor(0, 1); //Ustawienie kursora lcd.print("4.ENDING"); //Wyświetlenie tekstu delay(3000); lcd.clear(); //Ustawienie kursora lcd.print("5.DISPLAY"); //Wyświetlenie tekstu lcd.setCursor(0, 1); //Ustawienie kursora lcd.print("6.CONCERT"); //Wyświetlenie tekstu delay(3000);

The idea is that I want an instant reaction when I press one of the five buttons and if I don't press anything, this information just scrolls. Is that possible?

I run out of messages per day for a new user. If you can write how to do that I would be thankful. That's all for today from me.

Yes, but you haven't implemented cooperative multitasking. Your program style can only run one task at a time, now you want two. You have to use non-blocking code to do "more than one thing at a time".

You've got all the pieces, you just need to learn multitasking.
Overview | Multi-tasking the Arduino - Part 1 | Adafruit Learning System

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