cannot make serial available for Arduino Leonardo with my simple code

I'm newbie for arduino and i have one simple solution that i dont know what wrong with board or my code

my code is very simple below.

void setup(){ pinMode(0, OUTPUT); pinMode(1, OUTPUT); Serial.begin(9600); while(!Serial){ ; // wait for leonardo } } void loop(){ if (Serial.available() > 1){ digitalWrite(0, HIGH); } else { digitalWrite(1, HIGH); } }

when i'm upload to my arduino board it seem like Serial is not available and result always show LED on at pin 1. i think my code will turn LED at pin 0 on.

sorry for my simple question and i'll develop my code after i can through this step.

vakebi: when i'm upload to my arduino board it seem like Serial is not available and result always show LED on at pin 1. i think my code will turn LED at pin 0 on.

Serial.available() gives you the number of characters the Arduino has received in its serial input buffer.

You must send at least one character to the Arduino (perhaps from the Serial Monitor) for the number to be greater than 0.

If you are trying to do something else please let me know.

...R