Error Compiling

Electronic_Die.ino:11:1: error: expected unqualified-id before ‘{’ token
Error compiling.

Can some one please try to fix this because i don’t know what the error means
Thx

void setup() {
// put your setup code here, to run once:
randomSeed(analogRead(0)); // seed the random number generator
for ( int z = 1 ; z < 7 ; z++ ) // LEDs on pins 1-6 are output
{
pinMode(z, OUTPUT);
}
}

void randomLED(int del);
{
int r; // get a random number from 1-6
digitalWrite(r, HIGH); // output to the matching LED on digital pin 1-6
if (del > 0);
{
delay(del); // hold the LED on for the delay received
}
else if (del == 0);
{
do // the delay entered was zero, hold the LED on
forever
{}
while (1);
}
digitalWrite(r, LOW); // turn the LED off
}

void loop() {
// put your main code here, to run repeatedly:
int a;
// cycle the LEDs around for effect
for ( a = 0 ; a < 100 ; a++ )
{
randomLED(50);
}
// slow down
for ( a = 1 ; a <= 10 ; a++)
{
randomLED( a * 100);
}
// and stop at the final random number and LED
randomLED(0);
}

Electronic_Die.ino (927 Bytes)

 if (del > 0);
  {
    delay(del); // hold the LED on for the delay received
  }

The semicolon ( ; ) after your if statement should be removed.

void randomLED(int del);

Same...check all your code because you have more of those issues

WonderTiger:

 if (del > 0);

{
    delay(del); // hold the LED on for the delay received
  }




The semicolon (;) after your if statement should be removed.

thx :stuck_out_tongue:

HafsaEN:
Try this one :

void setup() {

// put your setup code here, to run once:
  randomSeed(analogRead(0)); // seed the random number generator
  for ( int z = 1 ; z < 7 ; z++ ) // LEDs on pins 1-6 are output
  {
    pinMode(z, OUTPUT);
  }
}

void randomLED(int del)
{
  int r; // get a random number from 1-6
  digitalWrite(r, HIGH); // output to the matching LED on digital pin 1-6
  if (del > 0)
  {
    delay(del); // hold the LED on for the delay received
  }
    else if (del == 0)
  {
    do // the delay entered was zero, hold the LED on
{}
    while (1);
  }
  digitalWrite(r, LOW); // turn the LED off
}

void loop() {
  // put your main code here, to run repeatedly:
  int a;
  // cycle the LEDs around for effect
  for ( a = 0 ; a < 100 ; a++ )
  {
    randomLED(50);
  }
  // slow down
  for ( a = 1 ; a <= 10 ; a++)
  {
    randomLED( a * 100);
  }
  // and stop at the final random number and LED
  randomLED(0);
}





but what do you want to mean by this line :

I’m going off by what the Arduino workshop book said
and thx for the code it worked