> For the complete documentation index, see [llms.txt](https://brlabelectronics.gitbook.io/tutorials-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brlabelectronics.gitbook.io/tutorials-1/control-relays-with-the-nextion-hmi-and-arduino/nano-every-code/writing-the-code/void-loop.md).

# void loop()

The void loop() is the loop that runs contiously. I also want to keep this section of the code clean and simple. To do that I am just going to see if there is any data on the serial port to be read. If so then I am going to clear out the cmd string, delay for 5ms just to ensure all the data is across, and then run a custom function called serial\_input() to proccess the data.&#x20;

```arduino
void loop() {
  if(Serial1.available()){ // is there any bytes on the serial 1 port buffer
    cmd = "";
    delay(5);
    serial_input(); // custom function to handle the messages over serial 
  }
}
```
