// Last Update 10-29-20     // Experimental Combinations
// Last Update 10-03-20     // Change all field2=0.20 to field2=0.20
// Last update 09-13-20     // Globally changed 28000.00 to 25920.00 hertz
                            // Above changes are strickly symbolic because
                            // the Arduino does not have 7 digit resolution
                            // There are 2 "Code Number Nine" protocols from
                            // Memory Groups 16 to 32 and 33 to 50
// Last used 10-03-20
// Intelligent_EEProm_Update_V3
//

#include <EEPROM.h>

#define defaultFreqTime 180000 // 3 minutes in milliSeconds = 180000
#define defaultRunTime 1800000 // 30 minutes in milliSeconds = 1800000
#define highEPromAd 900     // define High eeprom address
#define lowEPromAd 1        // define low eeprom address
#define startFreq 2         // default Starting Frequency Range group ID
#define startSweep 13       // default Starting Sweep Range group ID
#define stopFreq 11         // default Starting Frequency Range group ID
#define stopSweep 33        // default Starting Sweep Range group ID

byte mode = 2;              // Modes 1=SIMPLE, 2=PROTOCOL, 3=SWEEP

int eeAddress = 0;          // EEPROM initgial starting address
int protoID;                // protoID field

struct EPromObject {        // This structure contains the two channel basics
  int   field0;             // number of frequencies groups stored
  float field1;             // Frequency 1 
  float field2;             // Duty Cycle 1
  float field3;             // Frequnecy 2
  float field4;             // Duty Cycle 2
};

struct EPromObject2 {       // structure contains startup and range defaults
  int           field0;     // Last ProtoID used
  byte          field1;     // mode of operation SIMPLE, PROTOCOL, or SWEEP
  unsigned long field2;     // Total Program runtime in seconds eg. 600000 = 10 minutes
  unsigned long field3;     // Total frequency runtime in seconds eg 60000 = 1 minute
  int           field4;     // start group for Frequency Range
  int           field5;     // stop group for Frequency Range
  int           field6;     // start group for Sweep Range
  int           field7;     // stop group for Sweep Range
};

void setup() {
  pinMode(13, OUTPUT);    // initialize the LED pin as an output.
   
//    Iterate through each byte of the EEPROM storage.
//    Larger AVR processors have larger EEPROM sizes, E.g:
//    - Arduno Duemilanove: 512b EEPROM storage.
//    - Arduino Uno:        1kb EEPROM storage.
//    - Arduino Mega:       4kb EEPROM storage.
//    Rather than hard-coding the length, you should use the pre-provided length function.
//    This will make your code portable to all AVR processors.

  for (int i = 0 ; i < EEPROM.length() ; i++) {
    EEPROM.write(i, 0x00);
  }

  protoID=1;                          // initialize Protocol ID to 1
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar1;             // assign customVar1 structure to this EProm Object
  customVar1.field0=protoID;          // Store the protoID
  customVar1.field1=6000.00;          // Primary Frequency 1
  customVar1.field2=0.20;             // Duty Cycle 1
  customVar1.field3=100.00;           // Secondary Gating Frequency
  customVar1.field4=1.00;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar1);   // Update EProm
  
  protoID=2;                          // initialize Protocol ID to 2
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar2;             // assign customVar1 structure to this EProm Object
  customVar2.field0=protoID;          // Store the protoID
  customVar2.field1=25920.00;         // Primary Frequency 1
  customVar2.field2=0.20;             // Duty Cycle 1
  customVar2.field3=20.00;            // Secondary Gating Frequency
  customVar2.field4=0.50;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar2);   // Update EProm

  protoID=3;                          // initialize Protocol ID to 3
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar3;             // assign customVar1 structure to this EProm Object
  customVar3.field0=protoID;          // Store the protoID
  customVar3.field1=25920.00;         // Primary Frequency 1
  customVar3.field2=0.20;             // Duty Cycle 1
  customVar3.field3=120.00;           // Secondary Gating Frequency
  customVar3.field4=0.50;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar3);   // Update EProm

  protoID=4;                          // initialize Protocol ID to 4
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar4;             // assign customVar1 structure to this EProm Object
  customVar4.field0=protoID;          // Store the protoID
  customVar4.field1=25920.00;         // Primary Frequency 1
  customVar4.field2=0.20;             // Duty Cycle 1
  customVar4.field3=240.00;           // Secondary Gating Frequency
  customVar4.field4=0.50;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar4);   // Update EProm

  protoID=5;                          // initialize Protocol ID to 5
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar5;             // assign customVar1 structure to this EProm Object
  customVar5.field0=protoID;          // Store the protoID
  customVar5.field1=25920.00;         // Primary Frequency 1
  customVar5.field2=0.20;             // Duty Cycle 1
  customVar5.field3=300.00;           // Secondary Gating Frequency
  customVar5.field4=0.50;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar5);   // Update EProm
  
  protoID=6;                          // initialize Protocol ID to 6
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar6;             // assign customVar1 structure to this EProm Object
  customVar6.field0=protoID;          // Store the protoID
  customVar6.field1=25920.00;         // Primary Frequency 1
  customVar6.field2=0.20;             // Duty Cycle 1
  customVar6.field3=304.00;           // Secondary Gating Frequency
  customVar6.field4=0.50;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar6);   // Update EProm

  protoID=7;                          // initialize Protocol ID to 7
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar7;             // assign customVar1 structure to this EProm Object
  customVar7.field0=protoID;          // Store the protoID
  customVar7.field1=25920.00;         // Primary Frequency 1
  customVar7.field2=0.20;             // Duty Cycle 1
  customVar7.field3=328.00;           // Secondary Gating Frequency
  customVar7.field4=0.50;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar7);   // Update EProm

  protoID=8;                          // initialize Protocol ID to 8
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar8;             // assign customVar1 structure to this EProm Object
  customVar8.field0=protoID;          // Store the protoID
  customVar8.field1=25920.00;         // Primary Frequency 1
  customVar8.field2=0.20;             // Duty Cycle 1
  customVar8.field3=728.00;           // Secondary Gating Frequency
  customVar8.field4=0.50;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar8);   // Update EProm

  protoID=9;                          // initialize Protocol ID to 9
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar9;             // assign customVar1 structure to this EProm Object
  customVar9.field0=protoID;          // Store the protoID
  customVar9.field1=25920.00;         // Primary Frequency 1
  customVar9.field2=0.20;             // Duty Cycle 1
  customVar9.field3=880.00;           // Secondary Gating Frequency
  customVar9.field4=0.50;             // Duty Cycle 2
  EEPROM.put(eeAddress,customVar9);   // Update EProm

  protoID=10;                         // initialize Protocol ID to 10
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar10;            // assign customVar1 structure to this EProm Object
  customVar10.field0=protoID;         // Store the protoID
  customVar10.field1=5000.00;         // Primary Frequency 1
  customVar10.field2=0.20;            // Duty Cycle 1
  customVar10.field3=100.00;          // Secondary Gating Frequency
  customVar10.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar10);  // Update EProm

  protoID=11;                         // initialize Protocol ID to 11
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar11;            // assign customVar1 structure to this EProm Object
  customVar11.field0=protoID;         // Store the protoID
  customVar11.field1=10000.08;        // Primary Frequency 1
  customVar11.field2=0.20;            // Duty Cycle 1
  customVar11.field3=100.00  ;        // Secondary Gating Frequency
  customVar11.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar11);  // Update EProm

  protoID=12;                         // initialize Protocol ID to 12
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar12;            // assign customVar1 structure to this EProm Object
  customVar12.field0=protoID;         // Store the protoID
  customVar12.field1=25920.00;        // Primary Frequency 1
  customVar12.field2=0.20;            // Duty Cycle 1
  customVar12.field3=20.00;           // Secondary Gating Frequency
  customVar12.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar12);  // Update EProm

  protoID=13;                         // initialize Protocol ID to 13
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar13;            // assign customVar1 structure to this EProm Object
  customVar13.field0=protoID;         // Store the protoID
  customVar13.field1=6000.00;         // Primary Frequency 1
  customVar13.field2=0.20;            // Duty Cycle 1
  customVar13.field3=100.00;          // Secondary Gating Frequency
  customVar13.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar13);  // Update EProm

  protoID=14;                         // initialize Protocol ID to 14
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar14;            // assign customVar1 structure to this EProm Object
  customVar14.field0=protoID;         // Store the protoID
  customVar14.field1=25920.00;        // Primary Frequency 1
  customVar14.field2=0.20;            // Duty Cycle 1
  customVar14.field3=120.00;          // Secondary Gating Frequency
  customVar14.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar14);  // Update EProm

  protoID=15;                         // initialize Protocol ID to 15
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar15;            // assign customVar1 structure to this EProm Object
  customVar15.field0=protoID;         // Store the protoID
  customVar15.field1=6000.00;         // Primary Frequency 1
  customVar15.field2=0.20;            // Duty Cycle 1
  customVar15.field3=100.00;          // Secondary Gating Frequency
  customVar15.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar15);  // Update EProm

  protoID=16;                         // initialize Protocol ID to 16
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar16;            // assign customVar1 structure to this EProm Object
  customVar16.field0=protoID;         // Store the protoID
  customVar16.field1=25920.00;        // Primary Frequency 1
  customVar16.field2=0.20;            // Duty Cycle 1
  customVar16.field3=240.00;          // Secondary Gating Frequency
  customVar16.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar16);  // Update EProm

  protoID=17;                         // initialize Protocol ID to 17
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar17;            // assign customVar1 structure to this EProm Object
  customVar17.field0=protoID;         // Store the protoID
  customVar17.field1=6000.00;         // Primary Frequency 1
  customVar17.field2=0.20;            // Duty Cycle 1
  customVar17.field3=100.00;          // Secondary Gating Frequency
  customVar17.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar17);  // Update EProm
  
  protoID=18;                         // initialize Protocol ID to 18
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar18;            // assign customVar1 structure to this EProm Object
  customVar18.field0=protoID;         // Store the protoID
  customVar18.field1=25920.00;        // Primary Frequency 1
  customVar18.field2=0.20;            // Duty Cycle 1
  customVar18.field3=300.00;          // Secondary Gating Frequency
  customVar18.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar18);  // Update EProm

  protoID=19;                         // initialize Protocol ID to 19
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar19;            // assign customVar1 structure to this EProm Object
  customVar19.field0=protoID;         // Store the protoID
  customVar19.field1=6000.00;         // Primary Frequency 1
  customVar19.field2=0.20;            // Duty Cycle 1
  customVar19.field3=100.00;          // Secondary Gating Frequency
  customVar19.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar19);  // Update EProm

  protoID=20;                         // initialize Protocol ID to 20
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar20;            // assign customVar1 structure to this EProm Object
  customVar20.field0=protoID;         // Store the protoID
  customVar20.field1=25920.00;        // Primary Frequency 1
  customVar20.field2=0.20;            // Duty Cycle 1
  customVar20.field3=304.00;          // Secondary Gating Frequency
  customVar20.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar20);  // Update EProm

  protoID=21;                         // initialize Protocol ID to 21
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar21;            // assign customVar1 structure to this EProm Object
  customVar21.field0=protoID;         // Store the protoID
  customVar21.field1=6000.00;         // Primary Frequency 1
  customVar21.field2=0.20;            // Duty Cycle 1
  customVar21.field3=100.00;          // Secondary Gating Frequency
  customVar21.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar21);  // Update EProm
  
  protoID=22;                         // initialize Protocol ID to 22
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar22;            // assign customVar1 structure to this EProm Object
  customVar22.field0=protoID;         // Store the protoID
  customVar22.field1=25920.00;        // Primary Frequency 1
  customVar22.field2=0.20;            // Duty Cycle 1
  customVar22.field3=328.00;          // Secondary Gating Frequency
  customVar22.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar22);  // Update EProm

  protoID=23;                         // initialize Protocol ID to 23
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar23;            // assign customVar1 structure to this EProm Object
  customVar23.field0=protoID;         // Store the protoID
  customVar23.field1=6000.00;         // Primary Frequency 1
  customVar23.field2=0.20;            // Duty Cycle 1
  customVar23.field3=100.00;          // Secondary Gating Frequency
  customVar23.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar23);  // Update EProm

  protoID=24;                         // initialize Protocol ID to 24
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar24;            // assign customVar1 structure to this EProm Object
  customVar24.field0=protoID;         // Store the protoID
  customVar24.field1=25920.00;        // Primary Frequency 1
  customVar24.field2=0.20;            // Duty Cycle 1
  customVar24.field3=728.00;          // Secondary Gating Frequency
  customVar24.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar24);  // Update EProm

  protoID=25;                         // initialize Protocol ID to 25
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar25;            // assign customVar1 structure to this EProm Object
  customVar25.field0=protoID;         // Store the protoID
  customVar25.field1=6000.00;         // Primary Frequency 1
  customVar25.field2=0.20;            // Duty Cycle 1
  customVar25.field3=100.00;          // Secondary Gating Frequency
  customVar25.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar25);  // Update EProm

  protoID=26;                         // initialize Protocol ID to 26
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar26;            // assign customVar1 structure to this EProm Object
  customVar26.field0=protoID;         // Store the protoID
  customVar26.field1=25920.00;        // Primary Frequency 1
  customVar26.field2=0.20;            // Duty Cycle 1
  customVar26.field3=880.00;          // Secondary Gating Frequency
  customVar26.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar26);  // Update EProm

  protoID=27;                         // initialize Protocol ID to 27
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar27;            // assign customVar1 structure to this EProm Object
  customVar27.field0=protoID;         // Store the protoID
  customVar27.field1=6000.00;         // Primary Frequency 1
  customVar27.field2=0.20;            // Duty Cycle 1
  customVar27.field3=100.00;          // Secondary Gating Frequency
  customVar27.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar27);  // Update EProm

  protoID=28;                         // initialize Protocol ID to 28
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar28;            // assign customVar1 structure to this EProm Object
  customVar28.field0=protoID;         // Store the protoID
  customVar28.field1=25920.00;        // Primary Frequency 1
  customVar28.field2=0.20;            // Duty Cycle 1
  customVar28.field3=5000.00;         // Secondary Gating Frequency
  customVar28.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar28);  // Update EProm

  protoID=29;                         // initialize Protocol ID to 29
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar29;            // assign customVar1 structure to this EProm Object
  customVar29.field0=protoID;         // Store the protoID
  customVar29.field1=6000.00;         // Primary Frequency 1
  customVar29.field2=0.20;            // Duty Cycle 1
  customVar29.field3=100.00;          // Secondary Gating Frequency
  customVar29.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar29);  // Update EProm

  protoID=30;                         // initialize Protocol ID to 30
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar30;            // assign customVar1 structure to this EProm Object
  customVar30.field0=protoID;         // Store the protoID
  customVar30.field1=10000.00;        // Primary Frequency 1
  customVar30.field2=0.20;            // Duty Cycle 1
  customVar30.field3=100.00;          // Secondary Gating Frequency
  customVar30.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar30);  // Update EProm

  protoID=31;                         // initialize Protocol ID to 31
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar31;            // assign customVar1 structure to this EProm Object
  customVar31.field0=protoID;         // Store the protoID
  customVar31.field1=6000.00;         // Primary Frequency 1
  customVar31.field2=0.20;            // Duty Cycle 1
  customVar31.field3=100.00;          // Secondary Gating Frequency
  customVar31.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar31);  // Update EProm

  protoID=32;                         // initialize Protocol ID to 32
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar32;            // assign customVar1 structure to this EProm Object
  customVar32.field0=protoID;         // Store the protoID
  customVar32.field1=6000.00;         // Primary Frequency 1
  customVar32.field2=0.20;            // Duty Cycle 1
  customVar32.field3=20.00;           // Secondary Gating Frequency
  customVar32.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar32);  // Update EProm

  protoID=33;                         // initialize Protocol ID to 1
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar33;            // assign customVar1 structure to this EProm Object
  customVar33.field0=protoID;         // Store the protoID
  customVar33.field1=6000.00;         // Primary Frequency
  customVar33.field2=0.20;            // Duty Cycle 1
  customVar33.field3=120.00;          // Secondary Gating
  customVar33.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar33);  // Update EProm
  
  protoID=34;                         // initialize Protocol ID to 2
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar34;            // assign customVar1 structure to this EProm Object
  customVar34.field0=protoID;         // Store the protoID
  customVar34.field1=6000.00;         // Primary Frequency 1
  customVar34.field2=0.20;            // Duty Cycle 1
  customVar34.field3=240.00;          // Secondary Gating 1
  customVar34.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar34);  // Update EProm

  protoID=35;                         // initialize Protocol ID to 3
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar35;            // assign customVar1 structure to this EProm Object
  customVar35.field0=protoID;         // Store the protoID
  customVar35.field1=6000.00;         // Primary Frequency 
  customVar35.field2=0.20;            // Duty Cycle 1
  customVar35.field3=300.00;          // Secondary Gating  
  customVar35.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar35);  // Update EProm

  protoID=36;                         // initialize Protocol ID to 4
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar36;            // assign customVar1 structure to this EProm Object
  customVar36.field0=protoID;         // Store the protoID
  customVar36.field1=6000.00;         // Primary Frequency 1
  customVar36.field2=0.20;            // Duty Cycle 1
  customVar36.field3=304.00;          // Secondary Gating 2
  customVar36.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar36);  // Update EProm

  protoID=37;                         // initialize Protocol ID to 5
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar37;            // assign customVar1 structure to this EProm Object
  customVar37.field0=protoID;         // Store the protoID
  customVar37.field1=6000.00;         // Primary Frequency
  customVar37.field2=0.20;            // Duty Cycle 1
  customVar37.field3=328.00;          // Secondary Gating 2
  customVar37.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar37);  // Update EProm
  
  protoID=38;                         // initialize Protocol ID to 6
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar38;            // assign customVar1 structure to this EProm Object
  customVar38.field0=protoID;         // Store the protoID
  customVar38.field1=6000.00;         // Primary Frequency
  customVar38.field2=0.20;            // Duty Cycle 1
  customVar38.field3=728.00;          // Secondary Gating
  customVar38.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar38);  // Update EProm

  protoID=39;                         // initialize Protocol ID to 7
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar39;            // assign customVar1 structure to this EProm Object
  customVar39.field0=protoID;         // Store the protoID
  customVar39.field1=6000.00;         // Primary Frequency
  customVar39.field2=0.20;            // Duty Cycle 1
  customVar39.field3=880.00;          // Secondary Gating
  customVar39.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar39);  // Update EProm

  protoID=40;                         // initialize Protocol ID to 8
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar40;            // assign customVar1 structure to this EProm Object
  customVar40.field0=protoID;         // Store the protoID
  customVar40.field1=5000.00;         // Primary Frequency
  customVar40.field2=0.20;            // Duty Cycle 1
  customVar40.field3=100.00;          // Secondary Gating
  customVar40.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar40);  // Update EProm

  protoID=41;                         // initialize Protocol ID to 9
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar41;            // assign customVar1 structure to this EProm Object
  customVar41.field0=protoID;         // Store the protoID
  customVar41.field1=10000.00;        // Primary Frequency
  customVar41.field2=0.20;            // Duty Cycle 1
  customVar41.field3=100.00;          // Secondary Gating
  customVar41.field4=1.00;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar41);  // Update EProm

  protoID=42;                         // initialize Protocol ID to 10
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar42;            // assign customVar1 structure to this EProm Object
  customVar42.field0=protoID;         // Store the protoID
  customVar42.field1=25920.00;        // Primary Frequency - Precession
  customVar42.field2=0.20;            // Duty Cycle 1
  customVar42.field3=72.00;           // Secondary Gating - Brain
  customVar42.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar42);  // Update EProm

  protoID=43;                         // initialize Protocol ID to 11
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar43;            // assign customVar1 structure to this EProm Object
  customVar43.field0=protoID;         // Store the protoID
  customVar43.field1=25920.00;        // Primary Frequency -Precession
  customVar43.field2=0.20;            // Duty Cycle 1
  customVar43.field3=7.83;            // Secondary Gating - Schumann
  customVar43.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar43);  // Update EProm

  protoID=44;                         // initialize Protocol ID to 12
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar44;            // assign customVar1 structure to this EProm Object
  customVar44.field0=protoID;         // Store the protoID
  customVar44.field1=25920.00;        // Primary Frequency -Precession
  customVar44.field2=0.20;            // Duty Cycle 1
  customVar44.field3=369.00;          // Secondary Gating Solfeggio
  customVar44.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar44);  // Update EProm

  protoID=45;                         // initialize Protocol ID to 13
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar45;            // assign customVar1 structure to this EProm Object
  customVar45.field0=protoID;         // Store the protoID
  customVar45.field1=25920.00;        // Primary Frequency -Precession
  customVar45.field2=0.20;            // Duty Cycle 1
  customVar45.field3=417.00;          // Secondary Gating Solfeggio
  customVar45.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar45);  // Update EProm

  protoID=46;                         // initialize Protocol ID to 14
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar46;            // assign customVar1 structure to this EProm Object
  customVar46.field0=protoID;         // Store the protoID
  customVar46.field4=0.50;            // Duty Cycle 2
  customVar46.field1=25920.00;        // Primary Frequency -Precession
  customVar46.field2=0.20;            // Duty Cycle 1
  customVar46.field3=528.00;          // Secondary Gating Solfeggio
  EEPROM.put(eeAddress,customVar46);  // Update EProm

  protoID=47;                         // initialize Protocol ID to 15
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar47;            // assign customVar1 structure to this EProm Object
  customVar47.field0=protoID;         // Store the protoID
  customVar47.field1=25920.00;        // Primary Frequency -Precession
  customVar47.field2=0.20;            // Duty Cycle 1
  customVar47.field3=639.00;          // Secondary Gating Solfeggio
  customVar47.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar47);  // Update EProm

  protoID=48;                         // initialize Protocol ID to 16
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar48;            // assign customVar1 structure to this EProm Object
  customVar48.field0=protoID;         // Store the protoID
  customVar48.field1=25920.00;        // Primary Frequency -Precession
  customVar48.field2=0.20;            // Duty Cycle 1
  customVar48.field3=741.00;          // Secondary Gating Solfeggio
  customVar48.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar48);  // Update EProm

  protoID=49;                         // initialize Protocol ID to 17
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar49;            // assign customVar1 structure to this EProm Object
  customVar49.field0=protoID;         // Store the protoID
  customVar49.field1=25920.00;        // Primary Frequency -Precession
  customVar49.field2=0.20;            // Duty Cycle 1
  customVar49.field3=852.00;          // Secondary Gating Solfeggio
  customVar49.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar49);  // Update EProm
  
  protoID=50;                         // initialize Protocol ID to 17
  eeAddress=(protoID-1)*18;           // point to proper "Frequency Set" eeprom area 
  EPromObject customVar50;            // assign customVar1 structure to this EProm Object
  customVar50.field0=protoID;         // Store the protoID
  customVar50.field1=25920.00;        // Primary Frequency - Precession
  customVar50.field2=0.20;            // Duty Cycle 1
  customVar50.field3=432.00;          // Secondary Gating - Pythagorean
  customVar50.field4=0.50;            // Duty Cycle 2
  EEPROM.put(eeAddress,customVar50);  // Update EProm

  protoID=1;                          // initialize Protocol ID to 1
  eeAddress=highEPromAd;              // define starting eeprom address
  EPromObject2 customVarHigh;         // Variables to store custom objects in EEPROM
  customVarHigh.field0=protoID;       // set the default last_protoID to present protoID
  customVarHigh.field1=mode;          // set to default SIMPLE Mode 1   
  customVarHigh.field2=defaultFreqTime;// set to run frequencies for default 3 minutes
  customVarHigh.field3=defaultRunTime;// set to 30 minutes default program Run time
  customVarHigh.field4=startFreq;     // set a default Start Frequency Group ID  
  customVarHigh.field5=stopFreq;      // set a default Stop Frequency Group ID
  customVarHigh.field6=startSweep;    // set a defaull Start Sweep Group ID
  customVarHigh.field7=stopSweep;     // set a default Stop Sweep Group ID
  EEPROM.put(eeAddress,customVarHigh);// Update EProm

  // Flash LED 10 times and then leave it on when done

  for(int i=0; i<10; ++i) {
  digitalWrite(13, HIGH);
  delay(369);
  digitalWrite(13, LOW);
  delay(369);
  }
  digitalWrite(13, HIGH);
}

void loop() {
  /** Empty loop. **/
}