|
Post by Pokahpolice on Oct 8, 2015 8:39:30 GMT -5
Writing code will drive you nuts if your not a programmer I did an ardino build and don't recommend it for the average person this is way beyond rooting your phone Agreed, I did an Arduino build as well (Arduino is the base that Reef Angel uses) and found that the programming was a nightmare. I even have some exposure to C++ coding. Arduino doesn't use C++ but it's similar. I spent hours upon hours reading and writing code to program it. If you're looking for a 'plug and play' option than I would steer clear. If you don't mind getting on forums, doing research, asking questions, trouble shooting and spending hours sifting through code...you'll be fine. I find that even the Apex is something you need to be somewhat technically savvy to work with. I had to change the setting on my home network an router for it to work properly, which is not an easy task and took me several hours to figure out. The difference with Apex (from what I hear, I've never used them) is that they have amazing customer service and will walk you through everything if you get stuck. Just so you get a feel for the coding with an Arduino. This is a small portion of my controller coding. It's maybe 1/10th of the coding. //LIBRARIES//LIBRARIES #include <ITDB02_Graph16.h> #include <avr/pgmspace.h> #include <ITDB02_Touch.h> #include <Wire.h> #include <EEPROM.h> #include "writeAnything.h" #include <DS1307.h> #include <OneWire.h> #include <DallasTemperature.h>
//Default Controller Settings boolean RECOM_RCD = true; //For Mean Well drivers change "true" to "false" boolean CLOCK_SCREENSAVER = true; //For a Clock Screensaver "true" / Blank Screen "false" //You can turn the Screensaver ON/OFF in the pogram //TOUCH PANEL and ITDB02 MEGA SHIELD //(Mega Shield utilizes pins 5V, 3V3, GND, 2-6, 20-41, & (50-53 for SD Card)) ITDB02 myGLCD(38,39,40,41,ITDB32S); //May need to add "ITDB32S" depending on LCD controller ITDB02_Touch myTouch(6,5,4,3,2);
//Declare which fonts to be utilized extern uint8_t SmallFont[]; extern uint8_t BigFont[]; extern uint8_t SevenSegNumFont[];
#define LARGE true #define SMALL false
//Define the PWM PINS for the LEDs const int ledPinSump = 7; //PowerLed Shield pin 10 const int ledPinBlue = 8; //PowerLed Shield pin 5 const int ledPinWhite = 9; //PowerLed Shield pin 3 const int ledPinRoyBlue = 10; //PowerLed Shield pin 6 const int ledPinRed = 11; //PowerLed Shield pin 9 const int ledPinUV = 12; //PowerLed Shield pin 11 const int ledPinMoon = 13; //PowerLed Shield pin 13 (Modification to Shield & NOT controlled by an array)
// Define the other DIGITAL and/or PWM PINS being used const int tempHeatPin = 52; //Heater on/off (set thermostat on heater to highest desired level) const int tempChillPin = 53; //Chiller on/off (set thermostat on chiller to lowest desired level) const int WaveMakerTop = 42; //Hydor Koralia Evolution (Top Plug) const int WaveMakerBottom = 43; //Hydor Koralia Evolution (Bottom Plug) const int HoodFansPWM = 44; //PWM Hood Heatsink Fan (code added so frequency = 25kHz) const int SumpFanPWM = 45; //PWM Sump Heatsink Fan (code added so frequency = 25kHz) const int HoodFansTranzPin = 47; //Hood Heatsink Fan on/off const int SumpFanTranzPin = 48; //Sump Heatsink Fan on/off const int tempAlarmPin = 49; //Buzzer Alarm for Temperature offsets const int autoFeeder = 50; //Automatic Fish Feeder
// DS18B20 Temperature sensors plugged into pin 51 (Water, Hood, & Sump) OneWire OneWireBus(51); //Choose a digital pin // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&OneWireBus); // Assign the addresses of temperature sensors. Add/Change addresses as needed. DeviceAddress waterThermometer = { 0x28, 0x5C, 0x56, 0x59, 0x03, 0x00, 0x00, 0xEB }; DeviceAddress hoodThermometer = { 0x28, 0xC8, 0x4E, 0x59, 0x03, 0x00, 0x00, 0xC4 }; DeviceAddress sumpThermometer = { 0x28, 0x72, 0x22, 0x37, 0x03, 0x00, 0x00, 0xB9 };
float tempW = 0; //Water temperature values float tempH = 0; //Heatsink temperature float tempS = 0; //Sump heatsink temperature int TempToBeginHoodFanInDegC = 29; //Temperature to Turn on Hood Fans (in Degrees C) int TempToBeginSumpFanInDegC = 29; //Temperature to Turn on Sump Fan (in Degrees C) float FanOn = 0.2; //Starts Fan(s) at 20% Duty Cycle int HoodTempInterval = 0; //Used for PWM Duty calculations int SumpTempInterval = 0; //Used for PWM Duty calculations float HoodFanSpeedIncrease = 0; //Used for PWM Duty calculations float SumpFanSpeedIncrease = 0; //Used for PWM Duty calculations float HoodPWM = 0; //Used for PWM Duty calculations float SumpPWM = 0; //Used for PWM Duty calculations
float setTempC = 0.0; //Desired Water Temperature (User input in program) float setTempF = 0.0; float offTempC = 0.0; //Desired Water Temp. Offsets for Heater & Chiller (User input in program) float offTempF = 0.0; float alarmTempC = 0.0; //Temperature the Alarm will sound (User input in program) float alarmTempF = 0.0; boolean tempCoolflag = 0; //1 if cooling on boolean tempHeatflag = 0; //1 if heating on boolean tempAlarmflag = 0; //1 if alarm on long intervalAlarm = 1000 * 30; //Interval to beep the Alarm (1000 * seconds) float temp2beS; //Temporary Temperature Values float temp2beO; //Temporary Temperature Values float temp2beA; //Temporary Temperature Values int setTempScale = 0; //Celsius=0 || Fahrenheit=1 (change in prog) String degC_F; //Used in the Conversion of Celsius to Fahrenheit
int setCalendarFormat = 0; //DD/MM/YYYY=0 || Month DD, YYYY=1 (change in prog) int setTimeFormat = 0; //24HR=0 || 12HR=1 (change in prog) int rtc[7], rtcSet[7]; //Clock arrays int rtcSet2, AM_PM, yTime; //Setting clock stuff int timeDispH, timeDispM, xTimeH, xTimeM10, xTimeM1, xTimeAMPM, xColon; byte data[56]; String time, date, day;
float LC = 29.53059; //1 Lunar Cycle = 29.53059 days String LP; //LP = Lunar Phase - variable used to print out Moon Phase double AG; int MI, tMI; //Maximum Illumination of Moon (User Defined/Set in Prog. -- Default = 0) int MoonLow = 43; //Highest Value (0-255) at which Led is Still OFF, or the Value //you wish the New Moon to Shine (it will increase from here to MI)
unsigned int *MoonPic; //Pointer to the Lunar Phase Pics extern unsigned int //Lunar Phase Pics New_Moon[0xD24], Waxing_Crescent[0xD24], First_Quarter[0xD24], Waxing_Gibbous[0xD24], Full_Moon[0xD24], Waning_Gibbous[0xD24], Last_Quarter[0xD24], Waning_Crescent[0xD24];
int dispScreen=0; //0-Main Screen, 1-Menu, 2-Clock Setup, 3-Temp Control, //4-LED Test Options, 5-Test LED Arrays, 6-Test Individual //LED Colors, 7-Choose LED Color, 8-View Selected Color //Values, 9-Change Selected Color Array Values //10-Wavemaker, 11-Wavemaker Settings, 12-General //Settings, 13-Automatic Feeder, 14-Set Feeder Timers, //15-About int x, y; //touch coordinates
long previousMillisLED = 0; //Used in the Test LED Array Function long previousMillisWave = 0; //Used in the WaveMaker Function wave_output() long previousMillisFive = 0; //Used in the Main Loop (Checks Time,Temp,LEDs,Screen) long previousMillisAlarm = 0; //Used in the Alarm
int setScreensaver = 2; //ON=1 || OFF=2 (change in prog) int screenSaverTimer = 0; //counter for Screen Saver int setScreenSaverTimer = (20)*12; //how long in (minutes) before Screensaver comes on
boolean SCREEN_RETURN = true; //Auto Return to mainScreen() after so long of inactivity int returnTimer = 0; //counter for Screen Return int setReturnTimer = setScreenSaverTimer * .75; //Will return to main screen after 75% of the amount of //time it takes before the screensaver turns on
boolean waveMakerOff = false; //For Turning ON/OFF WaveMaker boolean waveMakerTest = false; //For Testing Wave Settings long wPump1, wPump2; //Total Alternating Times long intervalAlt = wPump1; //Changing Interval for Alternating Mode long wOnForT, wOffForT; //Total Synchronous-Pulse Times long intervalSynch = wOnForT; //Changing Interval for Synch-Pulse Mode int PumpTstate = LOW; //Used to set the Top Powerhead ON or OFF int PumpBstate = LOW; //Used to set the Bottom Powerhead ON or OFF
int WAVE, Pump1m, Pump1s, Pump2m, //EEPROM vars Pump2s, Synch, OnForTm, OnForTs, OffForTm, OffForTs; int MODE = WAVE; int MIN1=0, SEC1=0, MIN2=0, SEC2=0, //Used in the Wavemaker viewWaveTimes() minY1, minY2; int Min1=0, Sec1=0, Min2=0, Sec2=0; //Used in the Wavemaker viewWaveTimesPage() & wave+/- int min1X=91, sec1X=237, //Used in the Wavemaker waveModePlusMinus() min2X=91, sec2X=237, tTime1=0, tTime2=0; int WaveCorrector = 2; //Fix for halving of wave seconds (Change to "1" if //your wave seconds are doubled) long previousMillisCt = 0; //stores the last update for the Countdown Timer long intervalCt = 1000; //One Second Interval for Countdown Timer int countDown = 5*60 + 0; //Countdown for 5 minutes and zero seconds int MIN_O = 5; //Start the Time at 5 (for looks only) int SEC_T = 0; int SEC_O = 0;
int LedChangTime = 0; //LED change page, time and values
int min_cnt; //Used to determine the place in the color arrays
boolean LEDtestTick = false; //for testing leds and speed up clock
int whiteLed, blueLed, rblueLed, //previous LED output values redLed, uvLed, sumpLed; int bled_out, wled_out, rbled_out, //current LED output values rled_out, uvled_out, sled_out, moonled_out, colorled_out;
int COLOR=0, WHITE=1, BLUE=2, //Used to Determine View/Change Color LED Values ROYAL=3, RED=4, ULTRA=5, SUMP=6, MOON=7;
boolean colorLEDtest = false; //To test individual color LEDs int Rgad=0, Ggad=0, Bgad=0, //Used in the Test Ind. Color LEDs Gadget Rfont=0, Gfont=0, Bfont=0, Rback=0, Gback=0, Bback=0, Rline=0, Gline=0, Bline=0; int CL_1=0, CL_10=0, CL_100=0, //Used in the Test Ind. Color LEDs Gadget cl_1, cl_10, cl_100; int bcol_out, wcol_out, rbcol_out, //Current LED output values for Test Ind. Color LEDs rcol_out, uvcol_out, scol_out, mooncol_out; int x1Bar=0, x2Bar=0, //Used in LED Output Chart on Test Ind. LEDs Screen xValue=0, yValue=0, LEDlevel, yBar; int feedTime; int FEEDTime1, FEEDTime2, FEEDTime3, FEEDTime4;
int feedFish1H, feedFish1M, //Times to feed the fish feedFish2H, feedFish2M, feedFish3H, feedFish3M, feedFish4H, feedFish4M; int setAutoStop = 2; //ON=1 || OFF=2 (change in prog) int fiveTillBackOn1, fiveTillBackOn2, fiveTillBackOn3, fiveTillBackOn4; boolean FeedWaveCtrl_1 = false; boolean FeedWaveCtrl_2 = false; boolean FeedWaveCtrl_3 = false; boolean FeedWaveCtrl_4 = false;
//DIMMING VALUES can be changed below BUT the EEPROM must be cleared first. //To CLEAR EEPROM, use arduino-0022\libraries\EEPROM\examples\eeprom_clear\eeprom_clear.pde //and change the 512 to 4096 before Upload. After the LED comes on indicating the EEPROM //has been cleared, it is now ok to change DIMMING VALUES below & Upload the sketch. //SUMP Dimming Values 8pm to 8am byte sled[96] = { 192, 200, 200, 200, 200, 200, 200, 200, //0 - 1 200, 200, 200, 200, 200, 200, 200, 200, //2 - 3 197, 195, 192, 190, 175, 175, 175, 175, //4 - 5 140, 140, 140, 140, 105, 95, 85, 75, //6 - 7 0, 0, 0, 0, 0, 0, 0, 0, //8 - 9 0, 0, 0, 0, 0, 0, 0, 0, //10 - 11 0, 0, 0, 0, 0, 0, 0, 0, //12 - 13 0, 0, 0, 0, 0, 0, 0, 0, //14 - 15 0, 0, 0, 0, 0, 0, 0, 0, //16 - 17 0, 0, 0, 0, 0, 0, 0, 0, //18 - 19 75, 85, 95, 105, 140, 140, 140, 140, //20 - 21 175, 175, 175, 175, 190, 192, 195, 197 //22 - 23 }; //REGULAR BLUE Dimming Values byte bled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 26, 30, 40, 50, 60, 70, 80, 90, //6 - 7 100, 110, 120, 125, 130, 140, 150, 160, //8 - 9 170, 180, 190, 200, 210, 220, 220, 220, //10 - 11 220, 220, 220, 220, 220, 220, 220, 220, //12 - 13 220, 220, 220, 220, 220, 220, 220, 220, //14 - 15 220, 220, 220, 220, 220, 195, 180, 175, //16 - 17 170, 165, 160, 160, 160, 150, 145, 140, //18 - 19 135, 130, 125, 115, 100, 75, 60, 30, //20 - 21 30, 30, 28, 28, 0, 0, 0, 0 //22 - 23 }; //WHITE Dimming Values (White LED array in RAM) byte wled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 0, 0, 0, 0, 2, 10, 20, 30, //6 - 7 40, 50, 60, 70, 80, 90, 100, 100, //8 - 9 100, 100, 100, 100, 100, 100, 100, 100, //10 - 11 100, 100, 100, 100, 100, 100, 100, 100, //12 - 13 100, 100, 100, 100, 105, 105, 105, 105, //14 - 15 105, 105, 105, 105, 100, 100, 100, 100, //16 - 17 100, 100, 100, 100, 90, 80, 65, 50, //18 - 19 40, 30, 20, 10, 5, 0, 0, 0, //20 - 21 0, 0, 0, 0, 0, 0, 0, 0 //22 - 23 }; //ROYAL BLUE Dimming Values byte rbled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 10, 20, 30, 40, 50, 60, 70, 80, //6 - 7 90, 100, 110, 120, 130, 140, 150, 160, //8 - 9 170, 180, 195, 200, 210, 210, 200, 200, //10 - 11 200, 200, 200, 200, 200, 200, 200, 200, //12 - 13 200, 200, 200, 200, 200, 200, 200, 220, //14 - 15 220, 220, 200, 190, 175, 170, 165, 160, //16 - 17 155, 150, 145, 145, 145, 135, 130, 125, //18 - 19 120, 115, 110, 110, 100, 75, 65, 50, //20 - 21 40, 35, 33, 28, 0, 0, 0, 0 //22 - 23 }; //RED Dimming Values byte rled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 0, 0, 0, 0, 0, 0, 0, 0, //6 - 7 10, 20, 30, 40, 50, 60, 70, 80, //8 - 9 90, 100, 100, 100, 100, 100, 100, 100, //10 - 11 100, 100, 100, 100, 100, 100, 100, 100, //12 - 13 90, 80, 70, 60, 50, 40, 30, 30, //14 - 15 20, 10, 0, 0, 0, 0, 0, 0, //16 - 17 0, 0, 0, 0, 0, 0, 0, 0, //18 - 19 0, 0, 0, 0, 0, 0, 0, 0, //20 - 21 0, 0, 0, 0, 0, 0, 0, 0 }; //ULTRA VIOLET (UV) Dimming Values byte uvled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 0, 0, 0, 0, 0, 0, 0, 0, //6 - 7 0, 0, 0, 0, 0, 0, 0, 0, //8 - 9 0, 0, 0, 0, 20, 25, 30, 35, //10 - 11 40, 45, 50, 55, 60, 65, 70, 70, //12 - 13 65, 60, 55, 50, 45, 40, 35, 30, //14 - 15 25, 20, 30, 40, 50, 60, 70, 80, //16 - 17 90, 100, 110,120, 130, 140, 150, 150, //18 - 19 150, 150, 150, 100, 100, 100, 100, 100, //20 - 21 100, 100, 50, 10, 0, 0, 0, 0 }; byte tled[96]; //Temporary Array to Hold changed LED Values #include <ITDB02_Graph16.h> #include <avr/pgmspace.h> #include <ITDB02_Touch.h> #include <Wire.h> #include <EEPROM.h> #include "writeAnything.h" #include <DS1307.h> #include <OneWire.h> #include <DallasTemperature.h>
//Default Controller Settings boolean RECOM_RCD = true; //For Mean Well drivers change "true" to "false" boolean CLOCK_SCREENSAVER = true; //For a Clock Screensaver "true" / Blank Screen "false" //You can turn the Screensaver ON/OFF in the pogram //TOUCH PANEL and ITDB02 MEGA SHIELD //(Mega Shield utilizes pins 5V, 3V3, GND, 2-6, 20-41, & (50-53 for SD Card)) ITDB02 myGLCD(38,39,40,41,ITDB32S); //May need to add "ITDB32S" depending on LCD controller ITDB02_Touch myTouch(6,5,4,3,2);
//Declare which fonts to be utilized extern uint8_t SmallFont[]; extern uint8_t BigFont[]; extern uint8_t SevenSegNumFont[];
#define LARGE true #define SMALL false
//Define the PWM PINS for the LEDs const int ledPinSump = 7; //PowerLed Shield pin 10 const int ledPinBlue = 8; //PowerLed Shield pin 5 const int ledPinWhite = 9; //PowerLed Shield pin 3 const int ledPinRoyBlue = 10; //PowerLed Shield pin 6 const int ledPinRed = 11; //PowerLed Shield pin 9 const int ledPinUV = 12; //PowerLed Shield pin 11 const int ledPinMoon = 13; //PowerLed Shield pin 13 (Modification to Shield & NOT controlled by an array)
// Define the other DIGITAL and/or PWM PINS being used const int tempHeatPin = 52; //Heater on/off (set thermostat on heater to highest desired level) const int tempChillPin = 53; //Chiller on/off (set thermostat on chiller to lowest desired level) const int WaveMakerTop = 42; //Hydor Koralia Evolution (Top Plug) const int WaveMakerBottom = 43; //Hydor Koralia Evolution (Bottom Plug) const int HoodFansPWM = 44; //PWM Hood Heatsink Fan (code added so frequency = 25kHz) const int SumpFanPWM = 45; //PWM Sump Heatsink Fan (code added so frequency = 25kHz) const int HoodFansTranzPin = 47; //Hood Heatsink Fan on/off const int SumpFanTranzPin = 48; //Sump Heatsink Fan on/off const int tempAlarmPin = 49; //Buzzer Alarm for Temperature offsets const int autoFeeder = 50; //Automatic Fish Feeder
// DS18B20 Temperature sensors plugged into pin 51 (Water, Hood, & Sump) OneWire OneWireBus(51); //Choose a digital pin // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&OneWireBus); // Assign the addresses of temperature sensors. Add/Change addresses as needed. DeviceAddress waterThermometer = { 0x28, 0x5C, 0x56, 0x59, 0x03, 0x00, 0x00, 0xEB }; DeviceAddress hoodThermometer = { 0x28, 0xC8, 0x4E, 0x59, 0x03, 0x00, 0x00, 0xC4 }; DeviceAddress sumpThermometer = { 0x28, 0x72, 0x22, 0x37, 0x03, 0x00, 0x00, 0xB9 };
float tempW = 0; //Water temperature values float tempH = 0; //Heatsink temperature float tempS = 0; //Sump heatsink temperature int TempToBeginHoodFanInDegC = 29; //Temperature to Turn on Hood Fans (in Degrees C) int TempToBeginSumpFanInDegC = 29; //Temperature to Turn on Sump Fan (in Degrees C) float FanOn = 0.2; //Starts Fan(s) at 20% Duty Cycle int HoodTempInterval = 0; //Used for PWM Duty calculations int SumpTempInterval = 0; //Used for PWM Duty calculations float HoodFanSpeedIncrease = 0; //Used for PWM Duty calculations float SumpFanSpeedIncrease = 0; //Used for PWM Duty calculations float HoodPWM = 0; //Used for PWM Duty calculations float SumpPWM = 0; //Used for PWM Duty calculations
float setTempC = 0.0; //Desired Water Temperature (User input in program) float setTempF = 0.0; float offTempC = 0.0; //Desired Water Temp. Offsets for Heater & Chiller (User input in program) float offTempF = 0.0; float alarmTempC = 0.0; //Temperature the Alarm will sound (User input in program) float alarmTempF = 0.0; boolean tempCoolflag = 0; //1 if cooling on boolean tempHeatflag = 0; //1 if heating on boolean tempAlarmflag = 0; //1 if alarm on long intervalAlarm = 1000 * 30; //Interval to beep the Alarm (1000 * seconds) float temp2beS; //Temporary Temperature Values float temp2beO; //Temporary Temperature Values float temp2beA; //Temporary Temperature Values int setTempScale = 0; //Celsius=0 || Fahrenheit=1 (change in prog) String degC_F; //Used in the Conversion of Celsius to Fahrenheit
int setCalendarFormat = 0; //DD/MM/YYYY=0 || Month DD, YYYY=1 (change in prog) int setTimeFormat = 0; //24HR=0 || 12HR=1 (change in prog) int rtc[7], rtcSet[7]; //Clock arrays int rtcSet2, AM_PM, yTime; //Setting clock stuff int timeDispH, timeDispM, xTimeH, xTimeM10, xTimeM1, xTimeAMPM, xColon; byte data[56]; String time, date, day;
float LC = 29.53059; //1 Lunar Cycle = 29.53059 days String LP; //LP = Lunar Phase - variable used to print out Moon Phase double AG; int MI, tMI; //Maximum Illumination of Moon (User Defined/Set in Prog. -- Default = 0) int MoonLow = 43; //Highest Value (0-255) at which Led is Still OFF, or the Value //you wish the New Moon to Shine (it will increase from here to MI)
unsigned int *MoonPic; //Pointer to the Lunar Phase Pics extern unsigned int //Lunar Phase Pics New_Moon[0xD24], Waxing_Crescent[0xD24], First_Quarter[0xD24], Waxing_Gibbous[0xD24], Full_Moon[0xD24], Waning_Gibbous[0xD24], Last_Quarter[0xD24], Waning_Crescent[0xD24];
int dispScreen=0; //0-Main Screen, 1-Menu, 2-Clock Setup, 3-Temp Control, //4-LED Test Options, 5-Test LED Arrays, 6-Test Individual //LED Colors, 7-Choose LED Color, 8-View Selected Color //Values, 9-Change Selected Color Array Values //10-Wavemaker, 11-Wavemaker Settings, 12-General //Settings, 13-Automatic Feeder, 14-Set Feeder Timers, //15-About int x, y; //touch coordinates
long previousMillisLED = 0; //Used in the Test LED Array Function long previousMillisWave = 0; //Used in the WaveMaker Function wave_output() long previousMillisFive = 0; //Used in the Main Loop (Checks Time,Temp,LEDs,Screen) long previousMillisAlarm = 0; //Used in the Alarm
int setScreensaver = 2; //ON=1 || OFF=2 (change in prog) int screenSaverTimer = 0; //counter for Screen Saver int setScreenSaverTimer = (20)*12; //how long in (minutes) before Screensaver comes on
boolean SCREEN_RETURN = true; //Auto Return to mainScreen() after so long of inactivity int returnTimer = 0; //counter for Screen Return int setReturnTimer = setScreenSaverTimer * .75; //Will return to main screen after 75% of the amount of //time it takes before the screensaver turns on
boolean waveMakerOff = false; //For Turning ON/OFF WaveMaker boolean waveMakerTest = false; //For Testing Wave Settings long wPump1, wPump2; //Total Alternating Times long intervalAlt = wPump1; //Changing Interval for Alternating Mode long wOnForT, wOffForT; //Total Synchronous-Pulse Times long intervalSynch = wOnForT; //Changing Interval for Synch-Pulse Mode int PumpTstate = LOW; //Used to set the Top Powerhead ON or OFF int PumpBstate = LOW; //Used to set the Bottom Powerhead ON or OFF
int WAVE, Pump1m, Pump1s, Pump2m, //EEPROM vars Pump2s, Synch, OnForTm, OnForTs, OffForTm, OffForTs; int MODE = WAVE; int MIN1=0, SEC1=0, MIN2=0, SEC2=0, //Used in the Wavemaker viewWaveTimes() minY1, minY2; int Min1=0, Sec1=0, Min2=0, Sec2=0; //Used in the Wavemaker viewWaveTimesPage() & wave+/- int min1X=91, sec1X=237, //Used in the Wavemaker waveModePlusMinus() min2X=91, sec2X=237, tTime1=0, tTime2=0; int WaveCorrector = 2; //Fix for halving of wave seconds (Change to "1" if //your wave seconds are doubled) long previousMillisCt = 0; //stores the last update for the Countdown Timer long intervalCt = 1000; //One Second Interval for Countdown Timer int countDown = 5*60 + 0; //Countdown for 5 minutes and zero seconds int MIN_O = 5; //Start the Time at 5 (for looks only) int SEC_T = 0; int SEC_O = 0;
int LedChangTime = 0; //LED change page, time and values
int min_cnt; //Used to determine the place in the color arrays
boolean LEDtestTick = false; //for testing leds and speed up clock
int whiteLed, blueLed, rblueLed, //previous LED output values redLed, uvLed, sumpLed; int bled_out, wled_out, rbled_out, //current LED output values rled_out, uvled_out, sled_out, moonled_out, colorled_out;
int COLOR=0, WHITE=1, BLUE=2, //Used to Determine View/Change Color LED Values ROYAL=3, RED=4, ULTRA=5, SUMP=6, MOON=7;
boolean colorLEDtest = false; //To test individual color LEDs int Rgad=0, Ggad=0, Bgad=0, //Used in the Test Ind. Color LEDs Gadget Rfont=0, Gfont=0, Bfont=0, Rback=0, Gback=0, Bback=0, Rline=0, Gline=0, Bline=0; int CL_1=0, CL_10=0, CL_100=0, //Used in the Test Ind. Color LEDs Gadget cl_1, cl_10, cl_100; int bcol_out, wcol_out, rbcol_out, //Current LED output values for Test Ind. Color LEDs rcol_out, uvcol_out, scol_out, mooncol_out; int x1Bar=0, x2Bar=0, //Used in LED Output Chart on Test Ind. LEDs Screen xValue=0, yValue=0, LEDlevel, yBar; int feedTime; int FEEDTime1, FEEDTime2, FEEDTime3, FEEDTime4;
int feedFish1H, feedFish1M, //Times to feed the fish feedFish2H, feedFish2M, feedFish3H, feedFish3M, feedFish4H, feedFish4M; int setAutoStop = 2; //ON=1 || OFF=2 (change in prog) int fiveTillBackOn1, fiveTillBackOn2, fiveTillBackOn3, fiveTillBackOn4; boolean FeedWaveCtrl_1 = false; boolean FeedWaveCtrl_2 = false; boolean FeedWaveCtrl_3 = false; boolean FeedWaveCtrl_4 = false;
//DIMMING VALUES can be changed below BUT the EEPROM must be cleared first. //To CLEAR EEPROM, use arduino-0022\libraries\EEPROM\examples\eeprom_clear\eeprom_clear.pde //and change the 512 to 4096 before Upload. After the LED comes on indicating the EEPROM //has been cleared, it is now ok to change DIMMING VALUES below & Upload the sketch. //SUMP Dimming Values 8pm to 8am byte sled[96] = { 192, 200, 200, 200, 200, 200, 200, 200, //0 - 1 200, 200, 200, 200, 200, 200, 200, 200, //2 - 3 197, 195, 192, 190, 175, 175, 175, 175, //4 - 5 140, 140, 140, 140, 105, 95, 85, 75, //6 - 7 0, 0, 0, 0, 0, 0, 0, 0, //8 - 9 0, 0, 0, 0, 0, 0, 0, 0, //10 - 11 0, 0, 0, 0, 0, 0, 0, 0, //12 - 13 0, 0, 0, 0, 0, 0, 0, 0, //14 - 15 0, 0, 0, 0, 0, 0, 0, 0, //16 - 17 0, 0, 0, 0, 0, 0, 0, 0, //18 - 19 75, 85, 95, 105, 140, 140, 140, 140, //20 - 21 175, 175, 175, 175, 190, 192, 195, 197 //22 - 23 }; //REGULAR BLUE Dimming Values byte bled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 26, 30, 40, 50, 60, 70, 80, 90, //6 - 7 100, 110, 120, 125, 130, 140, 150, 160, //8 - 9 170, 180, 190, 200, 210, 220, 220, 220, //10 - 11 220, 220, 220, 220, 220, 220, 220, 220, //12 - 13 220, 220, 220, 220, 220, 220, 220, 220, //14 - 15 220, 220, 220, 220, 220, 195, 180, 175, //16 - 17 170, 165, 160, 160, 160, 150, 145, 140, //18 - 19 135, 130, 125, 115, 100, 75, 60, 30, //20 - 21 30, 30, 28, 28, 0, 0, 0, 0 //22 - 23 }; //WHITE Dimming Values (White LED array in RAM) byte wled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 0, 0, 0, 0, 2, 10, 20, 30, //6 - 7 40, 50, 60, 70, 80, 90, 100, 100, //8 - 9 100, 100, 100, 100, 100, 100, 100, 100, //10 - 11 100, 100, 100, 100, 100, 100, 100, 100, //12 - 13 100, 100, 100, 100, 105, 105, 105, 105, //14 - 15 105, 105, 105, 105, 100, 100, 100, 100, //16 - 17 100, 100, 100, 100, 90, 80, 65, 50, //18 - 19 40, 30, 20, 10, 5, 0, 0, 0, //20 - 21 0, 0, 0, 0, 0, 0, 0, 0 //22 - 23 }; //ROYAL BLUE Dimming Values byte rbled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 10, 20, 30, 40, 50, 60, 70, 80, //6 - 7 90, 100, 110, 120, 130, 140, 150, 160, //8 - 9 170, 180, 195, 200, 210, 210, 200, 200, //10 - 11 200, 200, 200, 200, 200, 200, 200, 200, //12 - 13 200, 200, 200, 200, 200, 200, 200, 220, //14 - 15 220, 220, 200, 190, 175, 170, 165, 160, //16 - 17 155, 150, 145, 145, 145, 135, 130, 125, //18 - 19 120, 115, 110, 110, 100, 75, 65, 50, //20 - 21 40, 35, 33, 28, 0, 0, 0, 0 //22 - 23 }; //RED Dimming Values byte rled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 0, 0, 0, 0, 0, 0, 0, 0, //6 - 7 10, 20, 30, 40, 50, 60, 70, 80, //8 - 9 90, 100, 100, 100, 100, 100, 100, 100, //10 - 11 100, 100, 100, 100, 100, 100, 100, 100, //12 - 13 90, 80, 70, 60, 50, 40, 30, 30, //14 - 15 20, 10, 0, 0, 0, 0, 0, 0, //16 - 17 0, 0, 0, 0, 0, 0, 0, 0, //18 - 19 0, 0, 0, 0, 0, 0, 0, 0, //20 - 21 0, 0, 0, 0, 0, 0, 0, 0 }; //ULTRA VIOLET (UV) Dimming Values byte uvled[96] = { 0, 0, 0, 0, 0, 0, 0, 0, //0 - 1 0, 0, 0, 0, 0, 0, 0, 0, //2 - 3 0, 0, 0, 0, 0, 0, 0, 0, //4 - 5 0, 0, 0, 0, 0, 0, 0, 0, //6 - 7 0, 0, 0, 0, 0, 0, 0, 0, //8 - 9 0, 0, 0, 0, 20, 25, 30, 35, //10 - 11 40, 45, 50, 55, 60, 65, 70, 70, //12 - 13 65, 60, 55, 50, 45, 40, 35, 30, //14 - 15 25, 20, 30, 40, 50, 60, 70, 80, //16 - 17 90, 100, 110,120, 130, 140, 150, 150, //18 - 19 150, 150, 150, 100, 100, 100, 100, 100, //20 - 21 100, 100, 50, 10, 0, 0, 0, 0 }; byte tled[96]; //Temporary Array to Hold changed LED Values
|
|