LCD screen alternating???

Hi guys i need some help.

I have 4 sets of values i want to show on my lcd but wont fit. So i want to switch between displaying 2 parameters, then a second later show the other 2 parameters.

Here is the header which stays on both screens:

 lcd.clear();                                            // Clears LCD screen
    lcd.print("..AQUATROLLER..");                                  // Displays AQAUTOLLER on top line
    lcd.setCursor(9,5);                                              // Positions cursor for TEMP: label

And this is the first set of code to display the first 2 parameters:

  lcd.print("WATER:");                                         // Displays WATER TEMP:
  lcd.setCursor(23,5);                                      // Positions cursor for degrees label
  lcd.print((char)223);                                      // Displays degrees symbol
  lcd.setCursor(24,5);                                      // Positions cursor of F label
  lcd.print("F");                                      // Displays F label
  lcd.setCursor(16,1);                                      // Positions cursor for HOOD: label
  lcd.print("HOOD:");                                      // Displays HOOD: label
  lcd.setCursor(30,1);                                      // Positions cursor for degrees label
  lcd.print((char)223);                                      // Displays degrees symbol
  lcd.setCursor(31,1);                                      // Positions cursor for F label
  lcd.print("F");                                      // Displays F label
     
  lcd.setCursor(19,5);                                      // Positions cursor to display WATER TEMP
  lcd.print(water_temp_f,DEC);                                   // Sends farenheit water temp to screen
  
  lcd.setCursor(27,1);                                      // Positions cursor to display HOOD TEMP
  lcd.print(HS_temp_f,DEC);                                  // Sends farenheit Hood temp to screen

and then this is the code to display the second set of parameters:

lcd.print("SG:");                                                 // Displays Specific Gravity:
  lcd.setCursor(20,5);
  lcd.print("1.022");
  lcd.setCursor(16,1);
  lcd.print("PH:");
  lcd.setCursor(29,1);
  lcd.print("7.8");

Now these both set out great when i put on either bit of the code but i cant get them to alternate.

I have an RTC running. is there any code that does something similiar to:

If second =odd, display first parameters
If second =even, display second parameters

Any help would be great as always!!

VR

You can use the square wave output of the RTC to generate interrupts every second.

Do you have an example of how i could use that? Im still learning everyday on this!

Thanks

VR

See the reference page for attachInterrupt: http://www.arduino.cc/en/Reference/AttachInterrupt

The example sketch on that page is pretty close to what you want if you connect the 1Hz signal to pin 2. the state variable would toggle between true and false every second.

I have an RTC running. is there any code that does something similiar to:

If second =odd, display first parameters
If second =even, display second parameters

If it’s not important to sync this to the RTC, you can use millis() to do what you suggest:

void alternate_display(void)
{
  static int long time = 0;
  static byte odd_even = 0;

  if (millis() - time > 1000)
  {
    odd_even = !odd_even;
    if (odd_even) // Even
      display_this();
    else  // Odd
      display_that();
  }
}

You must ofcourse call this function atleast every 1000ms.

Can the Arduino use the modulo operator? if so you could check simply your seconds:

Pseudocode:

if (rtc.seconds % 2 != 0)
{
//odd code}
}
else
{
//even code
}

@florinc

I’ve been trying this for a while but getting nowhere. Do you have a circuit diagram for connecting the RTC to the Arduino & initialisation code for the setting the time & enabling the square wave on the RTC?

Ideally I want the square wave output to trigger the interrupt which, in turn, reads the time frmo the RTC.

If you are considering DS1307 as your RTC, this is how it should look like:

#include <Wire.h>
#include <DS1307.h>


//--------------------------------------------------------------------------------------
/* DS1307 Real Time Clock - uses the wire library (I2C);
 *
 * RTC is set up through a separate sketch (+windows app talking on serial port).
 * I2C bus address of DS1307 is B1101000 (already defined in RTC.h).
 *
 * SETUP:     _ _                                
 *        X1-|oU |-Vcc
 *        X2-|   |-SQW/OUT square wave 1Hz output signal;
 *  Vbat(3V)-|   |-SCL     to Arduino analog 5
 *       GND-|   |-SDA     to Arduino analog 4
 *            --- 
 *
 * Pull-up resistors (10k) are required on SDA (pins 5), SCL (pin 6), and SQW (pin 7).
 *
 *
 * References:
 *    http://www.datasheetcatalog.org/datasheet/maxim/DS1307.pdf
*/
//--------------------------------------------------------------------------------------

int tick = 0;


// interrupt handler for the 1Hz square wave generated by RTC (wired to arduino digital pin 3);
void SQW_1Hz_ISR()
{
  tick++;
  Serial.print("in ISR: ");
  Serial.println(tick);
}

void setTime()
{
  RTC.stop();
  RTC.set(DS1307_SEC, 20);
  RTC.set(DS1307_MIN, 07);
  RTC.set(DS1307_HR,  12);
  RTC.set(DS1307_DOW,  3);
  RTC.set(DS1307_DATE,28);
  RTC.set(DS1307_MTH,  1);
  RTC.set(DS1307_YR,   9);
}

void setup()
{
// initialize stuff here...

  // call this only once; comment out after time was set in RTC;
  setTime();

  Serial.begin(9600);

  // code courtesy of Mr. BroHogan (a.k.a. "Life Clock");
  Wire.beginTransmission(0x68);
  Wire.send(0x07);
  Wire.send(0x90);                       // 0x90=1Hz, 0x91=4kHz, 0x92=8kHz, 0x93=32kHz
  Wire.endTransmission();


  // define ISR for pin 3 (1Hz square wave from RTC);
  attachInterrupt(1, SQW_1Hz_ISR, FALLING);
}

Is this what you were looking for?

You can get some inspiration from the playground (“interfacing with hardware” section, look for DS1307, there are 2 entries).

The “DS1307” library I used was published on and downloaded from the arduino playground.

These curly brackets really piss me off!!! I can never get them correct!!!

Ok here is the example you gave me skumlerud, but i cant get it to compile!!!

Take a look and see whats going on with the curly braces. If i take out that bit of code it compiles fine!!!

    }
    

    lcd.clear();                                            // Clears LCD screen
    lcd.print("..AQUATROLLER..");                                  // Displays AQAUTOLLER on top line
    lcd.setCursor(9,5);                                              // Positions cursor for TEMP: label

    
    void alternate_display(void)
{
    static int long time = 0;
    static byte odd_even = 0;

  
    if (millis() - time > 1000)
    {
    odd_even = !odd_even;
    if (odd_even) // Even
    
    lcd.print("WATER:");                                         // Displays WATER TEMP:
    lcd.setCursor(23,5);                                      // Positions cursor for degrees label
    lcd.print((char)223);                                      // Displays degrees symbol
    lcd.setCursor(24,5);                                      // Positions cursor of F label
    lcd.print("F");                                      // Displays F label
    lcd.setCursor(16,1);                                      // Positions cursor for HOOD: label
    lcd.print("HOOD:");                                      // Displays HOOD: label
    lcd.setCursor(30,1);                                      // Positions cursor for degrees label
    lcd.print((char)223);                                      // Displays degrees symbol
    lcd.setCursor(31,1);                                      // Positions cursor for F label
    lcd.print("F");                                      // Displays F label
     
    lcd.setCursor(20,5);                                      // Positions cursor to display WATER TEMP
    lcd.print(water_temp_f,DEC);                                   // Sends farenheit water temp to screen
  
    lcd.setCursor(27,1);                                      // Positions cursor to display HOOD TEMP
    lcd.print(HS_temp_f,DEC);                                  // Sends farenheit Hood temp to screen
   
   
    else  // Odd
    lcd.print("SG:");                                                 // Displays Specific Gravity:
    lcd.setCursor(20,5);
    lcd.print("1.022");
    lcd.setCursor(16,1);
    lcd.print("PH:");
    lcd.setCursor(29,1);
    lcd.print("7.8");
    }
  
}

It keeps saying:

In function ‘void loop()’:
error: a function-definition is not allowed here before ‘{’ token

:frowning:

The braces need to be around the blocks of code you want treated together and they need to be matched.

void alternate_display(void)
{
  static int long time = 0;
  static byte odd_even = 0;


  if (millis() - time > 1000)
  {  
    //  code in this block will be executed if a second has elapsed
    odd_even = !odd_even;
    if (odd_even) // Even
    { 
          // code in this block will execute if Even
      lcd.print("WATER:");                                         // Displays WATER TEMP:
      lcd.setCursor(23,5);                                      // Positions cursor for degrees label
      lcd.print((char)223);                                      // Displays degrees symbol
      lcd.setCursor(24,5);                                      // Positions cursor of F label
      lcd.print("F");                                      // Displays F label
      lcd.setCursor(16,1);                                      // Positions cursor for HOOD: label
      lcd.print("HOOD:");                                      // Displays HOOD: label
      lcd.setCursor(30,1);                                      // Positions cursor for degrees label
      lcd.print((char)223);                                      // Displays degrees symbol
      lcd.setCursor(31,1);                                      // Positions cursor for F label
      lcd.print("F");                                      // Displays F label

      lcd.setCursor(20,5);                                      // Positions cursor to display WATER TEMP
      lcd.print(water_temp_f,DEC);                                   // Sends farenheit water temp to screen

      lcd.setCursor(27,1);                                      // Positions cursor to display HOOD TEMP
      lcd.print(HS_temp_f,DEC);                                  // Sends farenheit Hood temp to screen   
    }  // end of Even Block

    else  // Odd
    {
      lcd.print("SG:");                                                 // Displays Specific Gravity:
      lcd.setCursor(20,5);
      lcd.print("1.022");
      lcd.setCursor(16,1);
      lcd.print("PH:");
      lcd.setCursor(29,1);
      lcd.print("7.8");
    } // end of Odd block
  } // end if millis check

}

It keeps saying:

In function ‘void loop()’:
error: a function-definition is not allowed here before ‘{’ token

The error message is correct. You attempt to declare a function inside a function, which is not allowed in C/C++. And as you said, you must understand what the curly braces are for. That’s essential when programming C/C++.

Here’s a suggestion on how to implement this. You didn’t post the entire code, so I had to make a few assumptions (like what kind of LCD-library you’re using). This piece of code will initialise the LCD, print a header, and then cycle between two “pages” every second. You need to fill in the “read_temp”-functions to display the actual temperatures.

#include <LiquidCrystal.h>

// LiquidCrystal display.
// Pin configuration
#define RS 12
#define RW 11
#define ENABLE 10
#define D4 5
#define D5 4
#define D6 3
#define D7 2

LiquidCrystal lcd(RS, RW, ENABLE, D4, D5, D6, D7);

void setup(void)
{
  lcd.clear); // Clears LCD screen
  lcd.print("..AQUATROLLER.."); // Displays AQAUTOLLER on top line
}

void loop(void)
{
  static int long time = 0;
  static byte odd_even = 0;

  if (millis() - time > 1000)
  {
    odd_even = !odd_even;
    if (odd_even)
      display_water_temp(read_water_temp(), read_hood_temp());
    else
      display_specific_gravity();
  }
}

int read_water_temp(void)
{
  int temp;

  // Do what you do to read water temperature here.
  // Assign temperature to 'temp'.

  // Then return it to the caller of this function.  
  return temp;
}

int read_hood_temp(void)
{
  int temp;

  // See comments in read_water_temp()  

  return temp;
}

void display_water_temp(int temp_water, int temp_hood)
{
  lcd.print("WATER:");
  lcd.setCursor(23,5);  // Positions cursor for degrees label
  lcd.print((char)223); // Displays degrees symbol
  lcd.setCursor(24,5);  // Positions cursor of F label
  lcd.print("F");       // Displays F label
  lcd.setCursor(16,1);  // Positions cursor for HOOD: label
  lcd.print("HOOD:");   // Displays HOOD: label
  lcd.setCursor(30,1);  // Positions cursor for degrees label
  lcd.print((char)223); // Displays degrees symbol
  lcd.setCursor(31,1);  // Positions cursor for F label
  lcd.print("F");       // Displays F label

  lcd.setCursor(20,5);  // Positions cursor to display WATER TEMP
  lcd.print(temp_water,DEC); // Sends farenheit water temp to screen

  lcd.setCursor(27,1); // Positions cursor to display HOOD TEMP
  lcd.print(temp_hood,DEC); // Sends farenheit Hood temp to screen
}

void display_specific_gravity(void)
{
  lcd.print("SG:");
  lcd.setCursor(20,5);
  lcd.print("1.022");
  lcd.setCursor(16,1);
  lcd.print("PH:");
  lcd.setCursor(29,1);
  lcd.print("7.8");
}

Btw. what kind of display are you using? Judging from the values used in your setCursor-calls, it must be atleast 32 columns and 6 rows big! I haven’t touched that part of the code, but I get a feeling that you have misinterpreted the meaning of these values.

OK here is my complete code:

                                     // AQUATROLLER  //

 //***************************Arduino Initialisation*********************************************************************************************************************************
 #include <LiquidCrystal.h>
 #include "Wire.h"
 #define DS1307_I2C_ADDRESS 0x68
 #define led_white_pin               10                                // Output to white leds on pwm pin 10
 #define alarmpin             13                              // Output to alarm circuit on digital pin 13
 #define led_actinic_pin       9                              // Output to actinic leds on pwm pin 9
 #define fuge_light_pin               12                                // Output to fuge light on digital pin 12

 LiquidCrystal lcd(6, 8, 7, 2, 3, 4, 5);

 int water_temp_sensor = 3;                                    // Water Temp Sensor connects to input pin 3
 int water_temp_c = 0,water_temp_f = 0;                                // Water temperature variables
 int samples[8];                                          // Water temperature variables to make a better precision
 int maxi = -100,mini = 100;                                    // Water integers to start max/min water temperature
 int i;

 int ph_sensor = 4;                                          // Ph sensor connects to input pin 4
 
 int salt_sensor = 1;                                                 // Salinity sensor connects to input pin 1

 int HS_value = 0;                                          // Lights Heat Sink Variable
 int HS_temp_sensor = 2;                                    // Lights heat Sink Temp sensor on input pin 2
 int HS_fanpin  = 11;                                          // Output to Heat Sink Fans on pwm pin 11
 int HS_temp_c = 0,HS_temp_f = 0;                                // Lights Heat Sink temperature variables
 int HS_samples[8];                                          // Lights Heat Sink temperature variables to make a better precision
 int HSmaxi = -100,HSmini = 100;                              // Lights Heat Sink integers to start max/min water temperature
 int I;


 unsigned long last_temperature_check_time = 0;                              // Time Delay Routine Setup
 unsigned long last_lcd_turn_on_time = 0;                            //

 //*************************RTC Intialisation****************************************************************************************************************************************

  // Convert normal decimal numbers to binary coded decimal
  byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}

  // Convert binary coded decimal to normal decimal numbers
  byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}

 // 1) Sets the date and time on the ds1307
 // 2) Starts the clock
 // 3) Sets hour mode to 24 hour clock
 // Assumes you're passing in valid numbers
void setDateDs1307(byte second,                                               // 0-59
                   byte minute,                                       // 0-59
                   byte hour,                                       // 1-23
                   byte dayOfWeek,                                 // 1-7
                   byte dayOfMonth,                                // 1-28/29/30/31
                   byte month,                                       // 1-12
                   byte year)                                       // 0-99
{
   Wire.beginTransmission(DS1307_I2C_ADDRESS);
   Wire.send(0);
   Wire.send(decToBcd(second));                                         // 0 to bit 7 starts the clock
   Wire.send(decToBcd(minute));
   Wire.send(decToBcd(hour));                                         // If you want 12 hour am/pm you need to set
                                                       // bit 6 (also need to change readDateDs1307)
   Wire.send(decToBcd(dayOfWeek));
   Wire.send(decToBcd(dayOfMonth));
   Wire.send(decToBcd(month));
   Wire.send(decToBcd(year));
   Wire.endTransmission();
}

 // Gets the date and time from the ds1307
void getDateDs1307(byte *second,
          byte *minute,
          byte *hour,
          byte *dayOfWeek,
          byte *dayOfMonth,
          byte *month,
          byte *year)
{
 // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.send(0);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);

 // A few of these need masks because certain bits are control bits
  *second     = bcdToDec(Wire.receive() & 0x7f);
  *minute     = bcdToDec(Wire.receive());
  *hour            = bcdToDec(Wire.receive() & 0x3f);                       // Need to change this if 12 hour am/pm
  *dayOfWeek  = bcdToDec(Wire.receive());
  *dayOfMonth = bcdToDec(Wire.receive());
  *month      = bcdToDec(Wire.receive());
  *year            = bcdToDec(Wire.receive());
}

void setup()
{
  //*******************************Setup Routine of RTC****************************************************************************************************************************
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  Wire.begin();                                                     // Starts 2 wire commuication with RTC module
  Serial.begin(9600);                                               // Starts Serial communication with PC
  pinMode (HS_fanpin,            OUTPUT);                                     // Sets digital pin 6 as an output pin
  pinMode (led_white_pin,     OUTPUT);                                     // Sets digital pin 5 as an output pin
  pinMode (alarmpin,            OUTPUT);                                     // Sets digital pin 4 as an output pin
  pinMode (led_white_pin,     OUTPUT);                                     // Sets digital pin 5 as an output pin
  pinMode (led_actinic_pin,   OUTPUT);                                     // Sets digital pin 3 as an output pin
  pinMode (fuge_light_pin,    OUTPUT);                                     // Sets digital pin 2 as an output pin



  //*****************************************************************************************
  //***************************SET TIME & DATE HERE******************************************

  // **********Change these values to what you want to set your clock**************************************************************************************************************
  
  
  // Remove (//) from front of..... setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year);
  // Then set the time and date and upload to Arduino,
  // Then place them back and save program

  second = 40;
  minute = 23;
  hour = 16;
  dayOfWeek = 3;
  dayOfMonth =11;
  month = 3;
  year = 9;

 //  setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year);

  //*******************************************************************************************************************************************************************************
  //*******************************************************************************************************************************************************************************
}

void loop()
{

   //*****************************Water Temp Time Delay Routine*********************************************************************************************************************

    unsigned long time = millis();
    if (time - last_temperature_check_time > 5000)                      // Has it been 5 seconds?
    {
    last_temperature_check_time = time;



    //************************Main Temp Read and Display Routine*******************************************************************************************************************

    lcd.clear();                                            // Clears LCD screen
    lcd.print("..AQUATROLLER..");                                  // Displays AQAUTOLLER on top line
    lcd.setCursor(9,5);                                              // Positions cursor for TEMP: label
 
void alternate_display(void)
{
  static int long time = 0;
  static byte odd_even = 0;


  if (millis() - time > 1000)
  {  
    //  code in this block will be executed if a second has elapsed
    odd_even = !odd_even;
    if (odd_even) // Even
    {
          // code in this block will execute if Even
      lcd.print("WATER:");                                         // Displays WATER TEMP:
      lcd.setCursor(23,5);                                      // Positions cursor for degrees label
      lcd.print((char)223);                                      // Displays degrees symbol
      lcd.setCursor(24,5);                                      // Positions cursor of F label
      lcd.print("F");                                      // Displays F label
      lcd.setCursor(16,1);                                      // Positions cursor for HOOD: label
      lcd.print("HOOD:");                                      // Displays HOOD: label
      lcd.setCursor(30,1);                                      // Positions cursor for degrees label
      lcd.print((char)223);                                      // Displays degrees symbol
      lcd.setCursor(31,1);                                      // Positions cursor for F label
      lcd.print("F");                                      // Displays F label

      lcd.setCursor(20,5);                                      // Positions cursor to display WATER TEMP
      lcd.print(water_temp_f,DEC);                                   // Sends farenheit water temp to screen

      lcd.setCursor(27,1);                                      // Positions cursor to display HOOD TEMP
      lcd.print(HS_temp_f,DEC);                                  // Sends farenheit Hood temp to screen  
    }  // end of Even Block

    else  // Odd
    {
      lcd.print("SG:");                                                 // Displays Specific Gravity:
      lcd.setCursor(20,5);
      lcd.print("1.022");
      lcd.setCursor(16,1);
      lcd.print("PH:");
      lcd.setCursor(29,1);
      lcd.print("7.8");
    } // end of Odd block
  } // end if millis check

}
   //********************************Water Temp Sensor Routine**********************************************************************************************************************
    for(i = 0;i<=7;i++)                                              // Gets 8 samples of temperature
    {
      samples[i] = ( 5.0 * analogRead(water_temp_sensor) * 100.0) / 1024.0;
      water_temp_c = water_temp_c + samples[i];
    }

    water_temp_c = water_temp_c/8.0;                                  // Better precision
    water_temp_f = (water_temp_c * 9)/ 5 + 32;                              // Converts celcius to fahrenheit

    if(water_temp_f > maxi) {maxi = water_temp_f;}                      // Set max temperature ( F )
    if(water_temp_f < mini) {mini = water_temp_f;}                      // Set min temperature ( F )






   //*****************************Heat Sink Temp Sensor Routine**********************************************************************************************************************
    for(I = 0;I<=7;I++)                                              // Gets 8 samples of temperature
    {
      HS_samples[I] = ( 5.0 * analogRead(HS_temp_sensor) * 100.0) / 1024.0;
      HS_temp_c = HS_temp_c + HS_samples[I];
    }

    HS_temp_c = HS_temp_c/8.0;                                          // Better precision
    HS_temp_f = (HS_temp_c * 9)/ 5 + 32;                              // Converts celcius to fahrenheit

    if(HS_temp_f > HSmaxi) {HSmaxi = HS_temp_f;}                      // Set max temperature ( F )
    if(HS_temp_f < HSmini) {HSmini = HS_temp_f;}                      // Set min temperature ( F )

  
       
    
    
    

  //*****************************Send Serial Data to Computer***************************************************************************************************************
   
 // Water Temp: 
    Serial.print(" Water Temp = ");
    Serial.print(water_temp_f,DEC);
    Serial.print("oF     ");
    water_temp_c = 0;
    
    
 // Hood Temp:
    Serial.print(" Hood Temp = ");
    Serial.print(HS_temp_f,DEC);
    Serial.print("oF     ");
    HS_temp_c = 0;

  }

  //**************************LCD Print Routine of RTC*****************************************************************************************************************************
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  lcd.setCursor(0,1);                                                       // Positions Cursor ready to display time & date
  if(hour < 10)                                                             // Places a zero in the time if hour < 10
  lcd.print('0');
  lcd.print(hour, DEC);                                                     // Prints hour to LCD
  lcd.print(":");
  if(minute < 10)                                                           // Places a zero in the time if minute < 10
  lcd.print('0');
  lcd.print(minute, DEC);                                                   // Prints minute to LCD
  lcd.print("   ");
  if(month < 10)                                                            // Places a zero in the time if month < 10
  lcd.print('0');
  lcd.print(month, DEC);                                                    // Prints month to LCD
  lcd.print("/");
  if(dayOfMonth < 10)                                                       // Places a zero in the time if day < 10
  lcd.print('0');
  lcd.print(dayOfMonth, DEC);                                               // Prints day to LCD
  lcd.print("/");
  if(year < 10)                                                             // Places a zero in the time if year < 10
  lcd.print('0');
  lcd.print(year, DEC);                                                     // Prints year to LCD


 
 //********************************Sunrise & Sunset Times**************************************************************************************************************************

  //Actinics Sunrise begins at 8am and fades in for an hour until fully on
  {
   if (hour ==8 ) analogWrite (led_actinic_pin, map(minute, 0,59,0,255) );  // Fades in Actinic light proportinally over an hour
   else if ((hour>8)&&(hour<22)) analogWrite (led_actinic_pin, 255);        // If controller turned on between 8am and 10pm lights will automatically turn on
  }  
      
  
  //Whites Sunrise begins at 9am and fades in for an hour until fully on 
  {
   if (hour ==9 ) analogWrite (led_white_pin, map(minute, 0,59,0,255) );    // Fades in White light proportinally over an hour
   else if ((hour>9)&&(hour<20)) analogWrite (led_white_pin, 255);          // If controller turned on between 9am and 8pm lights will automatically turn on
  } 
    
    
  //Whites Sunset begins at 8pm and fades out for an hour until fully off
  {
  if (hour ==20 ) analogWrite (led_white_pin, map(minute, 0,59,255,0) );    // Fades out White light proportinally over an hour
  } 
    
    
  //Actinics Sunset begins at 10pm and fades out for an hour until fully off
  {
  if (hour ==22 ) analogWrite (led_actinic_pin, map(minute, 0,59,255,0) );  // Fades out Actinic light proportinally over an hour
  } 
    

 //Refugium light on/off times
  {
   if ((hour > 7  )&&( hour < 23)) digitalWrite (fuge_light_pin, HIGH);     // Refugium light is on from 8am to 10pm
   else digitalWrite (fuge_light_pin, LOW); 
  }  

//********************************************************************************************************************************************************************************

}

MEM. When i place in your code i still got :

In function ‘void loop()’:
error: a function-definition is not allowed here before ‘{’ token
when i compiled it.

MEM. When i place in your code i still got :

In function ‘void loop()’:
error: a function-definition is not allowed here before ‘{’ token

You are still attempting to declare a function inside your loop()-function. This is not allowed. You must put the function outside loop() and call the function by it’s name from inside loop().

If you take a closer look at my example code you’ll see what I mean.