Someone help to find whats wrong with the code

int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;
char data = 0;

void setup() 
{
Serial.begin(9600);  
pinMode (led1, OUTPUT);
pinMode (led2, OUTPUT);
pinMode (led3, OUTPUT);
pinMode (led4, OUTPUT);
}

void loop() 
{
 data = Serial.read();
 if(data == 0 ){
   digtalWrite(led1 , HIGH);
 }
}

What does it do? What do you expect it to do?

Note that 0 is not the same as '0'.

spell digtalWrite() correctly

  digitalWrite(led1 , HIGH);

First, it’s considered bad form to go back and correct your original posts, as it makes it appears that the posts that pointed out the error were wrong…they weren’t.
Second, you can answer your own question by reading the Serial Basics series that’s part of the Useful Links that appears at the top of the Forum.

econjack:
First, it's considered bad form to go back and correct your original posts, as it makes it appears that the posts that pointed out the error were wrong...they weren't.

Original post was not edited :wink:

I got an error saying that (digitalWrite was not declared in this scope

The error message is:

exit status 1
'digtalWrite' was not declared in this scope

digitalWrite. I think I see the problem.

Post your latest code.

thanks for all you r help. I made a spelling mistake.