# Error: expected ';' before 'digitalWrite'

**URL:** <https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094>\
**Category:** Programming\
**Created:** [February 17, 2024, 3:35pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094 "2024-02-17T15:35:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![henri\_name1](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@henri\_name1](https://forum.arduino.cc/u/henri_name1)\
**Post date:** [February 17, 2024, 3:35pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/1 "2024-02-17T15:35:16Z")

</div>

I mega beginner I don't know what the error code: error: expected ';' before 'digitalWrite' means with the following code:  
`
void setup() {`

`
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
}
void loop() {
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
digitalWrite(6,LOW);
delay(100);
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
digitalWrite(6,LOW);
delay(100);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
digitalWrite(6,LOW);
delay(100);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
digitalWrite(6,LOW);
delay(100);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
digitalWrite(9,HIGH);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
digitalWrite(6,LOW);
delay(100);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
digitalWrite(9,LOW);
digitalWrite(8,HIGH);
digitalWrite(7,LOW);
digitalWrite(6,LOW);
delay(100)
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,HIGH);
digitalWrite(6,LOW);
delay(100);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
digitalWrite(6,HIGH);
delay(100);
}
`

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [February 17, 2024, 3:36pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/2 "2024-02-17T15:36:28Z")

</div>

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'  
  
Use **code tags** (the \< CODE/ \> icon above the compose window)&nbsp;to make it easier to read and copy for examination   
  
[https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum)

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [February 17, 2024, 3:38pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/3 "2024-02-17T15:38:14Z")

</div>

```cpp
    delay(100)
      digitalWrite(13, LOW);

```

Missing semicolon on the delay() function

The error message

```arduino
69:1: error: expected ';' before 'digitalWrite'

```

tells you to look at line 69 of the sketch and the missing semicolon is on the previous line

---

<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:** [February 17, 2024, 3:38pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/4 "2024-02-17T15:38:44Z")

</div>

```arduino

digitalWrite(6,LOW);
delay(100)
digitalWrite(13,LOW);

```

You are missing a **;** after **delay(100)**

---

<div class="post-metadata">

**Author:** ![henri\_name1](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@henri\_name1](https://forum.arduino.cc/u/henri_name1)\
**Post date:** [February 17, 2024, 3:50pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/5 "2024-02-17T15:50:14Z")

</div>

Thank you Thank you with the \<code wanted to do it but I was afraid that it would be formatted

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [February 17, 2024, 4:12pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/7 "2024-02-17T16:12:51Z")

</div>

The best thing to do when posting code is to use Edit/Auto Format in the IDE to tidy up the layout then use Edit/Copy for Forum to copy it and automatically add code tags ready to paste in a forum reply

---

<div class="post-metadata">

**Author:** ![s-a-martin](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@s-a-martin](https://forum.arduino.cc/u/s-a-martin)\
**Post date:** [February 17, 2024, 6:34pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/8 "2024-02-17T18:34:04Z")

</div>

Unrelated to your problem but if you learn about 'functions', 'arrays' and 'for loops' you could drastically simplify your code. I remember being blown away when I first combined these things together.

---

<div class="post-metadata">

**Author:** ![JohnRob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnrob/32/253560_2.png) [@JohnRob](https://forum.arduino.cc/u/JohnRob)\
**Post date:** [February 17, 2024, 6:46pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/9 "2024-02-17T18:46:26Z")

</div>

Boy your good. I'll bet you could pass the test where you have to count the "of" in a paragraph 😀

---

<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:** [August 15, 2024, 6:46pm UTC](https://forum.arduino.cc/t/error-expected-before-digitalwrite/1225094/10 "2024-08-15T18:46:46Z")

</div>

Closed on August 15, 2024, 6:46pm UTC

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