NeoPixel led WS2812B shines the right color only every 2nd time
So the weirdest thing fixed the issue. I created 2 more functions

void send_one_bit(int high, int low){
    DATA_PORT = high;
    __builtin_avr_delay_cycles(5);
    DATA_PORT = low;
    __builtin_avr_delay_cycles(1);
}

void send_zero_bit(int high, int low){
    DATA_PORT = high;
    __builtin_avr_delay_cycles(2);
    DATA_PORT = low;
    __builtin_avr_delay_cycles(1);
}


and used these to send zero or one byte

for(int i = 0; i &lt; 24; ++i){
    //send 1
    if(rgb_array[i]){   
        send_one_bit(high_data, low_data);
    }
    //send 0
    else{              
        send_zero_bit(high_data, low_data);
    }
}


If I take code out of these functions and put directly inside of if/else statement kind of inlining it I always get white color. I would be happy if someone could explain this weird thing.