Expected unqualified-id before "{" token

Hello… I am starting Arduino and I want to make a blinking LED light without using delay and using the millis function. Whenever I verify the code, it gives me an error message saying, “Expected unqualified-id before ‘{’ token.” I do not understand what this means and I would really appreciate any help understanding what mistake I am making in my code.

Here is my code:

int LED13;

const unsigned long eventInterval=1000;
unsigned long previousTime=0;
void setup() 
// put your setup code here, to run once:
{ 
Serial.begin(9600);
pinMode (13,OUTPUT);
}
// probably needs loop here:
void loop()
{
unsigned long currentTime = millis( );
if (currentTime - previousTime >= eventInterval)
{
digitalWrite (13,HIGH);
}

if previousTime = currentTime;  <<< needs == for a comparison
{ 
digitalWrite(LED13,LOW);
}
} // needs this to end loop()

(Code tweaked by Moderator, and code tags added. May not work yet, but syntax/format is more correct)

I would really appreciate any help understanding what mistake I am making in my code.

At the very least there should be a loop() function in the sketch but that is not the only problem

You should look at the built-in example: File->Examples->02.Digital0->BlinkWithoutDelay

As stated, there are several errors, three in this one line.

if previousTime = currentTime;

Look up the syntax of the if() statement.
Look up the syntax of comparison operators.

Also, use CTRL-T in the IDE to clean up the appearance of the code.

Thank you for your feedback. Problem solved :slight_smile:

I have another problem… Now the IDE is giving me an error saying expected primary expression before ‘<<.’ Can someone help me?

Here is the code:

#define LED13;

const unsigned long eventInterval = 1000;
unsigned long previousTime = 0;
void setup()
// put your setup code here, to run once:
{
Serial.begin(9600);
pinMode (13, OUTPUT);
}
// probably needs loop here:
void loop()
{
unsigned long currentTime = millis( );
if (currentTime - previousTime >= eventInterval)
{
digitalWrite (13, HIGH);
}

if (previousTime = currentTime); <<< needs == for a comparison
{
digitalWrite(LED13, LOW);
}
} // needs this to end loop()

  <<< needs == for a comparison

So why don’t you do it and remove this nonsense ?