user51554: I am trying to make some LED lights to turn on when i flick a switch on my RC crontroller. I will connect the signal wire from RC controller to pin 8. The plan is: if i flick the swich, the LED's (pin 12,11,10,9) will turn on, and if i don't flick the swich the LED's wont turn on. This is a Arduino nano what will be connected on a drone.I found another question HERE, but there was no real answers.
 I get a error that say: 

exit status 1
  could not convert 'digitalWrite(8u, 1u)' from 'void' to 'bool'

How can i fix this? Should i write the code another way?
Arduino Code:
    void setup() {

  pinMode(4, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, INPUT);



}


void loop() {

  if (digitalWrite(8, HIGH));
    digitalWrite(12, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(9, HIGH); 
  else 
    digitalWrite(12, LOW);
    digitalWrite(11, LOW);
    digitalWrite(10, LOW);
    digitalWrite(9, LOW);

  digitalWrite(4,HIGH);
  delay(1500);
  digitalWrite(4,LOW);
}


user25690: This line of code is the source of your problem. 

void loop() {

  if (digitalWrite(8, HIGH));


If expressions expect a boolean (true/false), but if you check the documentation for digitalWrite(), you’ll see it returns “Nothing” (i.e. void). 
You need to use digitalRead() to check the current state of the pin. 

user37523: You should be using digitalRead(8) instead of digitalWrite(8, HIGH). Your sketch is also missing some curly brackets.
void setup(){
  pinMode(4, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, INPUT);
}

void loop(){
  if(digitalRead(8) == HIGH){
    digitalWrite(12, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(9, HIGH);
  } 
  else{
    digitalWrite(12, LOW);
    digitalWrite(11, LOW);
    digitalWrite(10, LOW);
    digitalWrite(9, LOW);
  }
  digitalWrite(4,HIGH);
  delay(1500);
  digitalWrite(4,LOW);
}

The use of delay() will block the sketch from doing anything else, and should be replaced with a millis() timer. Have a look at the BlinkWithoutDelay example in the IDE.

51554: <p>I am trying to make some LED lights to turn on when i flick a switch on my RC crontroller. I will connect the signal wire from RC controller to pin 8. The plan is: if i flick the swich, the LED's (pin 12,11,10,9) will turn on, and if i don't flick the swich the LED's wont turn on. This is a Arduino nano what will be connected on a drone.I found another question <a href="https://arduino.stackexchange.com/questions/17006/arduino-ide-says-fcould-not-convert-pinmodebuttonsinti-0u-from-void">HERE</a>, but there was no real answers.
 I get a error that say: </p>

<blockquote>
  <p>exit status 1
  could not convert 'digitalWrite(8u, 1u)' from 'void' to 'bool'</p>
</blockquote>

<p>How can i fix this? Should i write the code another way?</p>

<p>Arduino Code:</p>

<pre><code>    void setup() {

  pinMode(4, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, INPUT);



}


void loop() {

  if (digitalWrite(8, HIGH));
    digitalWrite(12, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(9, HIGH); 
  else 
    digitalWrite(12, LOW);
    digitalWrite(11, LOW);
    digitalWrite(10, LOW);
    digitalWrite(9, LOW);

  digitalWrite(4,HIGH);
  delay(1500);
  digitalWrite(4,LOW);
}
</code></pre>
 25690: <p>This line of code is the source of your problem. </p>

<blockquote>
<pre><code>void loop() {

  if (digitalWrite(8, HIGH));
</code></pre>
</blockquote>

<p>If expressions expect a boolean (true/false), but if you check <a href="https://www.arduino.cc/reference/en/language/functions/digital-io/digitalwrite/" rel="nofollow noreferrer">the documentation for <code>digitalWrite()</code></a>, you’ll see it returns “Nothing” (i.e. <code>void</code>). </p>

<p>You need to use <a href="https://www.arduino.cc/reference/en/language/functions/digital-io/digitalread/" rel="nofollow noreferrer"><code>digitalRead()</code></a> to check the current state of the pin. </p>
 37523: <p>You should be using <code>digitalRead(8)</code> instead of <code>digitalWrite(8, HIGH)</code>. Your sketch is also missing some curly brackets.</p>

<pre><code>void setup(){
  pinMode(4, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, INPUT);
}

void loop(){
  if(digitalRead(8) == HIGH){
    digitalWrite(12, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(9, HIGH);
  } 
  else{
    digitalWrite(12, LOW);
    digitalWrite(11, LOW);
    digitalWrite(10, LOW);
    digitalWrite(9, LOW);
  }
  digitalWrite(4,HIGH);
  delay(1500);
  digitalWrite(4,LOW);
}
</code></pre>

<p>The use of <code>delay()</code> will block the sketch from doing anything else, and should be replaced with a <code>millis()</code> timer. Have a look at the <code>BlinkWithoutDelay</code> example in the IDE.</p>
