Use as a controller for aquarium led

last time i used one for this purpose i had to copy and paste a lot of bits and pieces together before i finally got something to work but it would seem all that code doesn't want to play ball with the newer software and now I'm stuck not really sure how to write the code from scratch looking for someone to write some code to get the unit working while i figure it out in my own time and adjust as necessary

im good at reading instructions in the sketches to figure things out but writting code for 4 channels is well above what i can do at this stage and im left scratching my head wondering how i got the arduino board to work last time around

if you don't want to learn, this seems a great ask for the Jobs and Paid Consultancy forum, make sure you mention your budget.

its not that i dont want to im just strugling making sense of what i need to do to create the code required, i have been resorting to modifying old code that has been giving me alot of trouble

Really, you haven't said much about your project. Assuming you were using NeoPixels or addressable LEDs the "last time", you should check out all the library examples for the LED library you are using. There is probably one that has multiple channels.

Nobody here is going to write the entire code for you for free, that is certain. If you post your best attempt and explain what problems exist with it, you can get some advice on how to fix it.

"some code to get the unit working while i figure it out in my own time and adjust as necessary" is what example code is, that is why 99.9999% of libraries have it.

it took me forever to find the code i used last time but i finnally found it

/*
   Name:	LightController.ino
   Author:	User "benjaf" at plantedtank.net forums
   URL:		https://github.com/benjaf/LightController
   This example is set up for 2 channels with a maximum of 10 points.
   Anything that may require editing is labeled with �CHANGE�

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

// ----------------------- RTC Library -----------------------
// Use Wire and RTClib (https://github.com/adafruit/RTClib):
// Please note that there are a significant differences between the original JeeLabs RTCLib and the Adafruit fork!
#include <Wire.h>
#include "RTClib.h"
#include "ChannelManager.h"

// ----------------------- Constants -----------------------
// �CHANGE�
const int MaxChannels = 4;   // Max number of channels, change if more or less are required
const int MaxPoints = 10;    // Max number of light intensity points, change if more or less are required

// ----------------------- Variables -----------------------
// RTC
RTC_DS1307 RTC;

// Time
DateTime CurrentTime;

// ----------------------- Lights -----------------------

// Schedule Point format: (Hour, Minute, Intensity)
// Difference in intensity between points is faded/increased gradually
// Example:
// 	Channels[0].AddPoint(8, 0, 0);
//	Channels[0].AddPoint(8, 30, 255);
//	Channels[0].AddPoint(11, 0, 255);
//  ...
//
// Explanation:
//  00:00 - 08:00 -> Light OFF
//  08:00 - 08:30 -> Increment light towards Fully ON
//  08:30 - 11:00 -> Light Fully ON
//
// Min intensity value: 0 (OFF)
// Max intensity value: 255 (Fully ON)
//
// If only 1 point is added, channel always maintains value of that point
//
// There is the option of which fade mode to use.
// Basically there are 2 modes: Linear and Exponential
// - Linear is what you would expect - 50% on = 50% duty cycle.
// - Exponential is an estimation of how our eyes react to brightness. The 'real' formula is actually inverse logarithmic,
// 	 but for our use exponential is close enough (feel free to add more fade modes if you disagree) - and much faster to compute!

Channel Channels[MaxChannels];
Point Points[MaxChannels][MaxPoints];

// Add more timing definitions here if more channels are added:
// �CHANGE�
void InitializeChannels(int channels) {
  

  // Channel 1:
  channelNo = 1;        // Currently editing channel 1
  pin = 6;                // Channel 1 uses pin 6
  Channels[channelNo] = Channel(pin, MaxPoints, fademode_linear, Points[channelNo]);
  Channels[channelNo].AddPoint(8, 0, 0); // 08:00 - Intensity = 0
  Channels[channelNo].AddPoint(8, 30, 180); // 08:30 - Intensity = 180
  Channels[channelNo].AddPoint(19, 30, 180); // 19:30 - Intensity = 180
  Channels[channelNo].AddPoint(20, 0, 0); // 20:00 - Intensity = 0

  // Channel 2:
  channelNo = 2;        // Currently editing channel 2
  pin = 9;                // Channel 2 uses pin 9
  Channels[channelNo] = Channel(pin, MaxPoints, fademode_linear, Points[channelNo]);
  Channels[channelNo].AddPoint(8, 0, 0);
  Channels[channelNo].AddPoint(8, 30, 180);
  Channels[channelNo].AddPoint(19, 30, 180);
  Channels[channelNo].AddPoint(20, 0, 0);

  // Channel 3:
  channelNo = 3;        // Currently editing channel 3
  pin = 10;                // Channel 3 uses pin 10
  Channels[channelNo] = Channel(pin, MaxPoints, fademode_linear, Points[channelNo]);
  Channels[channelNo].AddPoint(8, 0, 0);
  Channels[channelNo].AddPoint(8, 30, 180);
  Channels[channelNo].AddPoint(19, 30, 180);
  Channels[channelNo].AddPoint(20, 0, 0);

  // Channel 4:
  channelNo = 4;        // Currently editing channel 4
  pin = 11;                // Channel 4 uses pin 11
  Channels[channelNo] = Channel(pin, MaxPoints, fademode_linear, Points[channelNo]);
  Channels[channelNo].AddPoint(8, 0, 0);
  Channels[channelNo].AddPoint(8, 30, 180);
  Channels[channelNo].AddPoint(19, 30, 180);
  Channels[channelNo].AddPoint(20, 0, 0);


  // ----------------------- Functions -----------------------
  long lastUpdateTime = 0;

  // Update light intensity values
  void UpdateLights(DateTime currentTime)
  {
    long now = Seconds(currentTime.hour(), currentTime.minute(), currentTime.second());	// Convert current time to seconds since midnight
    if (now != lastUpdateTime)  	// Perform update only if there is a perceivable change in time (no point wasting clock cycles otherwise)
    {
      for (int channel = 0; channel < MaxChannels; channel++)    		// For each Channel
      {
        analogWrite(Channels[channel].GetPin(), Channels[channel].GetLightIntensityInt(now));	// Get updated light intensity and write value to pin (update is performed when reading value)
      }
    }
    lastUpdateTime = now;
  }


  // Convert HH:mm:ss -> Seconds since midnight
  long Seconds(int hours, int minutes, int seconds) {
    return ((long)hours * 60 * 60) + (minutes * 60) + seconds ;
  }

  // ----------------------- Setup -----------------------
  void setup() {
    // Initialize channel schedules
    InitializeChannels(MaxChannels);

    // Clock
    Wire.begin();
    RTC.begin();
    //RTC.adjust(DateTime(__DATE__, __TIME__));  // Set RTC time to sketch compilation time, only use for 1 (ONE) run. Will reset time at each device reset!
  }

  // ----------------------- Loop -----------------------
  void loop() {
    // Get current time
    CurrentTime = RTC.now();

    // Update lights
    UpdateLights(CurrentTime);
  }

'

the issue i now have is it hangs up on channel 1, "channel no" was not declared in this scope

This:

 channelNo = 1;    

Is this:

 int channelNo = 1;    

In the library example code.
Also, you're missing a closing brace at the end of the InitializeChannels function.

well that is one problem fixed now it is giving me issue on channel 4

redeclaration of "int channelno"

 // Channel 4:
  int channelNo = 4;        // Currently editing channel 4
  int pin = 11;                // Channel 4 uses pin 11
  Channels[channelNo] = Channel(pin, MaxPoints, fademode_linear, Points[channelNo]);
  Channels[channelNo].AddPoint(8, 0, 0);
  Channels[channelNo].AddPoint(8, 30, 180);
  Channels[channelNo].AddPoint(19, 30, 180);
  Channels[channelNo].AddPoint(20, 0, 0);
}

There was no need to make that change for channel 4, or any other apart from the first one in the function.

what change all the channels are copy pasted from the 1st one

That was a bad idea. Delete the word int from all but the first.

that did the trick, thankyou