how can I stop my Arduino code after 1 second?
You can use different ways:
Use setup only
Instead of putting code in the loop function,  put it in setup, which is only executed once (use a for loop to send around 1 second.
millis() excluding setup
It is better to use the millis function and compare it against the start of sending; when 1 second is reached, don't send anything or use an infinite while loop.
Use something like:
unsigned long time_start;

void setup()
{
    // Your normal code 

    time_start = millis();
}

void setup()
{
    if (millis() - time_start &gt;= 1000) 
    {
        while(1) {};
    }

    // your normal code (which should not take many ms,
    // otherwise the above code is not reached.

millis() including saetup (Thanks to Edgar Bonnet):
 void loop()
 {
     if (millis() &gt;= 1000)
     {
        while(1) {};
     }
 }

This will stop exactly after 1 s  after startup (excluding the setup). It will start counting after millis start counting, which is before the setup function.
Actually, in none of the above the Arduino 'stops', it just is doing endlessly nothing (well internally endlessly checking against the true condition which never changes).