swami412:
just need explanation for this instruction
while (!Serial && millis() < 5000) {}
On Arduino models with native USB (Leonardo, Micro, etc.) you are supposed to wait for "Serial" to be non-zero after calling Serial.begin(). If your Arduino is not connected to a USB host, "Serial" will remain zero. This line waits for up to 5 seconds for USB to connect and then goes on without it. On an Arduino UNO, Nano, Mega... the loop will end immediately since "Serial" is never zero.
johnwasser:
On Arduino models with native USB (Leonardo, Micro, etc.) you are supposed to wait for "Serial" to be non-zero after calling Serial.begin(). If your Arduino is not connected to a USB host, "Serial" will remain zero. This line waits for up to 5 seconds for USB to connect and then goes on without it. On an Arduino UNO, Nano, Mega... the loop will end immediately since "Serial" is never zero.
Thank you!
You've been very kind and alot helpful...