E xpected primary-expression before '>' token

Hi, here's my code to make an led turn on and off randomly, I received this error message (expected primary-expression before '>' token) and do not know why. Could you please help?

My code:

void setup() {
pinMode (3=OUTPUT);
Serial.begin(9600);
}

void loop() {
int data = random(0, 100);

Serial.print("data");
Serial.println(data);
delay(2500);
if (data == >50){ /* this is where the error occured.*/
digitalWrite(3=HIGH);
else {
digitalWrite(3=LOW)
}
}
}

  if (data == > 50) /* this is where the error occured.*/

use either

  if (data == 50) /* this is where the error occured.*/

or

  if (data >= 50) /* this is where the error occured.*/

Here is my updated code, i am given the error (Error compiling for board Arduino Uno.)
My code:
void setup() {
pinMode (3=OUTPUT);
Serial.begin(9600);
}

void loop() {
int data = random(0, 100);

Serial.print("data");
Serial.println(data);
delay(2500);
if (data >=50){
digitalWrite(3=HIGH);
}
else {
digitalWrite(3=LOW)
}
}

    digitalWrite(3 = HIGH);

The correct syntax for digitalWrite

    digitalWrite(pin, state);

Should be pinMode(3, OUTPUT);

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