void setup() { //Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) { ; }} // wait for serial port to connect. Needed for native USB
void loop() { //proceed normally
}
This example was taken directly from the Learning/Reference/Serial/ if(serial) tutorial on the arduino WEB site.
Question: Where is the sentence if(Serial) in this example ?
Suggestion: Maybe, someone ought to correct that tutorial and give a legitimate example with the actual if(serial) command.
I think the problem is that the link to that section should be named "while(!Serial)" - not "if(Serial)" - because if you are going to test for the presence/absence of the Serial port, you are far more likely to use while(!Serial) to wait for the port to start up.