IS IT POSSIBLE TO USE BOOLEAN-VALUES

hey Arduinos,

I writing on a simple code - in the end you see two methods where I define, what pin in what pair of the 2 D array should be high and which one should be low. For now, I writing:

const int motorPin[][3] = 
{{2, 3}, 
 {4, 5}, 
 {6, 7}};
 
 //byte num_Motors = 2;
 //byte num_Pairs = 3;
 
 int TransistorPin = 13;
 int paar;

const int enablePin [] = {
  8, 9, 10, 11};
  
//const int messPin = 21;
//int meet = 1;

int previousT = 0;
long interval = 5000;
long interval_2 = 10000;

unsigned long currentT;
boolean los = true;

//int meet = 1;
int myState;

void setup() {
  
  Serial.begin(57600);
  Serial.println("hier1");
  for(int MotorsHorizontal=0; MotorsHorizontal <3; MotorsHorizontal++){
    for(int MotorsVertical=0; MotorsVertical <4; MotorsVertical++){
      pinMode(motorPin[MotorsHorizontal][MotorsVertical], OUTPUT);
    }
  }
   Serial.println("hier2");
  for (int myEnables=0; myEnables<5; myEnables++){
      pinMode(enablePin[myEnables], OUTPUT);
      digitalWrite (enablePin[myEnables], HIGH);
  }
  
   Serial.println("hier3");
   pinMode(TransistorPin, OUTPUT);
   digitalWrite(TransistorPin, HIGH);
   
   myState = 0;
    Serial.println("hier9999");
}

void loop (){
{
  switch(myState)
  {
    case 0:
    Serial.println(millis());
    turnMotorsRight(paar);
    myState = 1;
    break;
    
    case 1:
    if (millis() - previousT > interval){
    turnMotorsLeft(paar);
      Serial.println("Interval_1 vorbei");
    myState = 2;
    break;
    }
    
    case 2:
     if(millis() - previousT > interval_2){
       previousT = millis();
       Serial.println("Interval_2 vorbei");
     myState = 0;
     break;
     }
  }}
};

void turnMotorsRight(int pair){
  digitalWrite(motorPin[pair][1], HIGH); // I'm actually talking about these two lines!
  digitalWrite(motorPin[pair][0], LOW);
  delay(100);
};

void turnMotorsLeft(int paar){
  //digitalWrite(motorPin[paar][1], LOW);
  //analogWrite(motorPin[paar][0], random(50,255));
  delay(100);
};

Wouldn't it be possible to summarize these two lines in only one by adding a logical "and" ??

void turnMotorsRight(int pair){
  digitalWrite(motorPin[pair][1], HIGH && (motorPin[pair][0], LOW);
  delay(100);
};

I read the Arduino Tutorial on Boolean Values, but there, boolean values are always used in if-conditions. Is this necessary?

best regards,
so

No. You can't use digitalWrite on two pins at the same time.

You've probably also noticed that the code didn't compile either.

And please don't SHOUT.

Okay, thanks for your answers anyway.
Next time I will use minor letters. :roll_eyes:

Have a nice evening...

StephanOrendi:
Wouldn't it be possible to summarize these two lines in only one by adding a logical "and" ??
...
I read the Arduino Tutorial on Boolean Values, but there, boolean values are always used in if-conditions. Is this necessary?

"Boolean Operator" does not mean "Concatenating Operator" like it does in other languages. && is only for comparisons.