How would i set the value of minimum?
These are the parts that have the max value. would i just add minimum too?
// Variables making use of EEPROM memory:
EEPROMVar<int> oneStartMins = 750; // minute to start this channel.
EEPROMVar<int> onePhotoPeriod = 720; // photoperiod in minutes for this channel.
EEPROMVar<int> oneMax = 100; // max intensity for this channel, as a percentage
EEPROMVar<int> oneFadeDuration = 60; // duration of the fade on and off for sunrise and sunset for
// this channel.
EEPROMVar<int> twoStartMins = 810;
EEPROMVar<int> twoPhotoPeriod = 600;
EEPROMVar<int> twoMax = 100;
EEPROMVar<int> twoFadeDuration = 60;
int oneStartMins = 1380; // minute to start this channel.
int onePhotoPeriod = 120; // photoperiod in minutes for this channel.
int oneMax = 100; // max intensity for this channel, as a percentage
int oneFadeDuration = 60; // duration of the fade on and off for sunrise and sunset for
// this channel.
int twoStartMins = 800;
int twoPhotoPeriod = 60;
int twoMax = 100;
int twoFadeDuration = 15;
/****** LED Functions ******/
/***************************/
//function to set LED brightness according to time of day
//function has three equal phases - ramp up, hold, and ramp down
int setLed(int mins, // current time in minutes
int ledPin, // pin for this channel of LEDs
int start, // start time for this channel of LEDs
int period, // photoperiod for this channel of LEDs
int fade, // fade duration for this channel of LEDs
int ledMax // max value for this channel
) {
int val = 0;
//fade up
if (mins > start || mins <= start + fade) {
val = map(mins - start, 0, fade, 0, ledMax);
}
//fade down
if (mins > start + period - fade && mins <= start + period) {
val = map(mins - (start + period - fade), 0, fade, ledMax, 0);
}
//off or post-midnight run.
if (mins <= start || mins > start + period) {
if((start+period)%1440 < start && (start + period)%1440 > mins )
{
val=map((start+period-mins)%1440,0,fade,0,ledMax);
}
else
val = 0;
}
if (val > ledMax) {val = ledMax;}
if (val < 0) {val = 0; }
analogWrite(ledPin, map(val, 0, 100, 0, 255));
if(override){val=overpercent;}
return val;
}
void setup() {
// Initialize channel variables. Set LED channel pin and retrieve values from EEPROM
channel[0].Led = 9;
channel[0].StartMins = oneStartMins;
channel[0].PhotoPeriod = onePhotoPeriod;
channel[0].Max = oneMax;
channel[0].FadeDuration = oneFadeDuration;
channel[1].Led = 10;
channel[1].StartMins = twoStartMins;
channel[1].PhotoPeriod = twoPhotoPeriod;
channel[1].Max = twoMax;
channel[1].FadeDuration = twoFadeDuration;