Preview:
#define EXE_INTERVAL_1 1000
#define EXE_INTERVAL_2 3000

unsigned long lastExecutedMillis_1 = 0; // vairable to save the last executed time for code block 1
unsigned long lastExecutedMillis_2 = 0; // vairable to save the last executed time for code block 2

void setup() {
  /*******************
   *  your setup code
   *******************/
}

void loop() {
  unsigned long currentMillis = millis();

  if (currentMillis - lastExecutedMillis_1 >= EXE_INTERVAL_1) {
    lastExecutedMillis_1 = currentMillis; // save the last executed time

    /********************
     * your code block 1
     ********************/
  }

  if (currentMillis - lastExecutedMillis_2 >= EXE_INTERVAL_2) {
    lastExecutedMillis_2 = currentMillis; // save the last executed time

    /********************
     * your code block 1
     ********************/
  }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter