Routine to simulate 24 hours in 24 seconds

I found this code that almost serves my purposes of simulating the 24 hour light usage in a building. I am trying to light an architectural model in a very realistic way. I have attached the schedule that I would like to have the lights light up at. I am a beginner and I really need help.

Below you will find the code that I am currently using. Can it be modified to serve my purposes? If so, how?

/* Blink without Delay

Based on Blink without Delay

*/

// constants won't change. Used here to set pin numbers:
  // Pin 13: Arduino has an LED connected on pin 13
  // Pin 11: Teensy 2.0 has the LED on pin 11
  // Pin 6: Teensy++ 2.0 has the LED on pin 6
const int led1 =  13;      // the number of the LED pin
const int led2 =  5;       // the number of the second LED
const int led3 =  6;       //3rd
const int led4 =  7;       //4th
const int led5 =  8;       //5th
// Variables will change:
int ledState1 = LOW;             // ledState used to set the LED
int ledState2 = LOW;             // ledState used to set the LED
int ledState3 = LOW;             // ledState used to set the LED
int ledState4 = LOW;             // ledState used to set the LED
int ledState5 = LOW;             // ledState used to set the LED
long previousMillis1 = 0;        // will store last time LED was updated
long previousMillis2 = 0;        // will store last time LED was updated
long previousMillis3 = 0;        // will store last time LED was updated
long previousMillis4 = 0;        // will store last time LED was updated
long previousMillis5 = 0;        // will store last time LED was updated


// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval1 = 500;           // interval at which to blink (milliseconds)
long interval2 = 700;           // interval at which to blink (milliseconds)
long interval3 = 800;           // interval at which to blink (milliseconds)
long interval4 = 400;           // interval at which to blink (milliseconds)
long interval5 = 550;           // interval at which to blink (milliseconds)

void setup() {
  // set the digital pin as output:
  pinMode(led1, OUTPUT);  
pinMode(led2, OUTPUT); 
pinMode(led3, OUTPUT); 
pinMode(led4, OUTPUT); 
pinMode(led5, OUTPUT); 
}

void loop()
{
 
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis1 > interval1) {
    // save the last time you blinked the LED 
    previousMillis1 = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState1 == LOW)
      ledState1 = HIGH;
    else
      ledState1 = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(led1, ledState1);
  }
   if(currentMillis - previousMillis2 > interval2) {
    // save the last time you blinked the LED 
    previousMillis2 = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState2 == LOW)
      ledState2 = HIGH;
    else
      ledState2 = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(led2, ledState2);
  }
   if(currentMillis - previousMillis3 > interval3) {
    // save the last time you blinked the LED 
    previousMillis3 = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState3 == LOW)
      ledState3 = HIGH;
    else
      ledState3 = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(led3, ledState3);
  }
   if(currentMillis - previousMillis4 > interval4) {
    // save the last time you blinked the LED 
    previousMillis4 = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState4 == LOW)
      ledState4 = HIGH;
    else
      ledState4 = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(led4, ledState4);
  }
   if(currentMillis - previousMillis5 > interval5) {
    // save the last time you blinked the LED 
    previousMillis5 = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState5 == LOW)
      ledState5 = HIGH;
    else
      ledState5 = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(led5, ledState5);
  }
}

Since the schedule has half-hour intervals, I'd define arrays for each LED with 48 elements. Use byte or bool so that each only requires one byte since each will contain only a zero (off) or a one (on). Then just a delay of about a half second for each interval. If you're adventuresome, a two-dimensional array would make for very compact code.

Welcome to the forum. Some good reading here on how to post code: http://forum.arduino.cc/index.php/topic,148850.msg1118324.html#post_codetags

Sorry about posting the code that way and thanks for the link.

Maybe you could go more in depth as to how I would do that... I'm really new to this, I feel like I understand the concepts and I can come up with logical solutions but the language is very new to me.

JC009:
Sorry about posting the code that way and thanks for the link.

No worries!

Maybe you could go more in depth as to how I would do that… I’m really new to this, I feel like I understand the concepts and I can come up with logical solutions but the language is very new to me.

Check out the sketch below, give it a try, ask questions. It does not use the “blink without delay” concept. That is a very important concept but there is actually no need for it here and given the other things that are going on, I thought I’d leave it out of the mix. But I strongly encourage you to understand it fully if you do not already.

In addition to running the LEDs, the sketch prints which schedule it’s on and the LED status to the serial monitor. Try a longer cycle time to better watch what’s happening. Typing in the schedules was probably the worst part, better double-check my typing. By the way, I think there was one too many columns, note that there is no 24:00 hours.

Google around for some C++ and/or Arduino tutorials. One that I use regularly is C++ Language - C++ Tutorials

const byte nLED = 5;                              //number of LEDs
const byte nSched = 48;                           //number of schedule entries for each LED
const unsigned long cycle = 500;                  //milliseconds for each "1/2 hour" cycle
const byte ledPins[nLED] = { 6, 7, 8, 9, 10 };    //LED pin numbers

const byte schedule[nLED][nSched] =  {            //LED schedules, 0=off, 1=on
//hr  0   1   2   3   4   5    6   7   8   9   10  11   12  13  14  15  16  17   18  19  20  21  22  23
    { 0,0,0,0,0,0,0,0,0,0,0,1, 1,1,1,1,0,0,0,0,0,0,0,0, 1,1,0,0,0,0,0,0,0,0,1,1, 1,1,1,1,1,1,1,1,1,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,0,0,0,0,0,0, 0,1,1,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,0 },
    { 0,0,0,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,1,1,1, 0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,1,1,1,1 },
    { 0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,1,1,1,1,1,1,1,0,0, 1,1,0,0,1,1,0,1,0,1,1,1, 1,1,1,1,1,1,0,0,0,0,0,0 },
    { 1,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,1,1,0,0, 0,0,0,1,0,0,0,0,0,0,0,0, 0,0,0,1,1,1,1,1,1,1,1,1 }
};

void setup(void)
{
    Serial.begin(9600);
    
    for (int l=0; l<nLED; l++) {             //set the LED pins as outputs
        pinMode(ledPins[l], OUTPUT);
    }
}

void loop(void)
{
    for ( int s = 0; s < nSched; s++ ) {     //step through the schedules
        Serial.print( "Schedule ");
        Serial.print(s);
        Serial.print( ':');
        for ( int l = 0; l < nLED; l++) {    //step through the LEDs
            Serial.print(' ');
            Serial.print(schedule[l][s]);
            digitalWrite( ledPins[l], schedule[l][s] );
        }
        Serial.println();
        delay(cycle);                        //delay between schedules
    }
}

Wow, thank you so much! And you're right about the 24 haha. This is working pretty well for my purposes, and I will definitely check out the link for C++.