Very Broken program

hi, I've been trying for a long time trying to figure out what I'm doing wrong. I did something and suddenly it keeps writing to me.
program:


#include <EEPROM.h>

#include <IRremote.h>

//Nastavitelné hodnoty

#define StartColor 2

#define Pamet 4096

#define ColorSwitchNumber 3

#define TvRgbPin 2

#define SecondRgbPin 7

#define ThirdRgbPin 10

#define AutosaveRate 255
//----------RGB Controller----------

//SwitchButton
byte
ColorSwitchButton = 0;

byte
ButtonTest = 0;

byte
ColorSwitch = 0;

//Saving to EEPROM

byte
AutosaveTimer = 0;

byte
AutosaveOn = 0;


//Analog inputs(Potenciometer 10k)

#define RedInputPin 0

#define GreenInputPin 1

#define BlueInputPin 2

//Led Colors

//analog

int
RedPotInput = 0;

int
GreenPotInput = 0;

int
BluePotInput = 0;

byte
RedPotOutput = 0;

byte
GreenPotOutput = 0;

byte
BluePotOutput = 0;

byte
RedVerify = 0;

byte
GreenVerify = 0;

byte
BlueVerify = 0;



//FinalColors
byte
RedFinal = 0;

byte
GreenFinal = 0;

byte
BlueFinal = 0;


byte
RedTvFinal = 0;

byte
GreenTvFinal = 0;

byte
BlueTvFinal = 0;

byte
RedSecondFinal = 0;

byte
GreenSecondFinal = 0;

byte
BlueSecondFinal = 0;

byte
RedThirdFinal = 0;

byte
GreenThirdFinal = 0;

byte
BlueThirdFinal = 0;



//----------Ostatni----------
byte
FirstCycle = 0;

byte
ColorInput = 0;

void setup() {

  Serial.begin(9600);

  //----------RGB Controller----------
  pinMode(22, INPUT);
  pinMode(52, OUTPUT);
  digitalWrite(52, 1);
  pinMode(LED_BUILTIN, OUTPUT);

}

void loop() {

  //----------RGB Controller----------

  //Splitter
  if (FirstCycle == 1) {
    if (ColorInput == 0) {
      //AutosaveRead();
      //ColorInput = 9;
    }
    if (ColorInput == 1) {
      RedFinal = RedPotOutput;
      GreenFinal = GreenPotOutput;
      BlueFinal = BluePotOutput;
      //      ColorInput = 9 ;
    }


  }

  //ColorSwitchButton
  ColorSwitchButton = digitalRead(22);
  if (ColorSwitchButton == 1) {
    ButtonTest ++;
  }
  else if (ColorSwitchButton == 0) {
    ButtonTest = 0;
  }

  if (ButtonTest >= 25) {
    digitalWrite (LED_BUILTIN, HIGH);
    ColorSwitch ++;
    ButtonTest = 25;
    delay(1000);

    if (ColorSwitch == ColorSwitchNumber ) {
      ColorSwitch = 0;
    }

  }
  else if (ButtonTest <= 25) {
    digitalWrite (LED_BUILTIN, LOW);
  }

  //RedPotOutput
  RedPotInput = analogRead(RedInputPin);
  RedPotOutput = map(RedPotInput, 0, 1023, 0, 255);

  //GreenPotInput
  GreenPotInput = analogRead(GreenInputPin);
  GreenPotOutput = map(GreenPotInput, 0, 1023, 0, 255);

  //BluePotOutput
  BluePotInput = analogRead(BlueInputPin);
  BluePotOutput = map(BluePotInput, 0, 1023, 0, 255);

  if (RedPotOutput != RedVerify || GreenPotOutput != GreenVerify || BluePotOutput != BlueVerify) {
    Color();
    ColorInput = 1;

    RedVerify = RedPotOutput;
    GreenVerify = GreenPotOutput;
    BlueVerify = BluePotOutput;
  }

  //Autosave
  if (AutosaveOn == 1) {
    if (AutosaveTimer == AutosaveRate) {
      AutosaveTimer = 0;
      AutosaveOn = 0;
      Autosave();

    }
  }


  Serial.println (ButtonTest);
  Serial.print (ColorSwitchButton);
  Serial.print (ColorSwitch);
  if (FirstCycle == 0) {
    FirstCycle = 1;
  }
}
void Color()  {

  //  if (ColorSwitch = 0){
  analogWrite(TvRgbPin, RedFinal);
  analogWrite(TvRgbPin + 1, GreenFinal);
  analogWrite(TvRgbPin + 2, BlueFinal);

  RedTvFinal = RedFinal;

  GreenTvFinal = GreenFinal;

  BlueTvFinal = BlueFinal;

}
if (ColorSwitch = 1) {
  analogWrite(SecondRgbPin, RedFinal);
  analogWrite(SecondRgbPin + 1, GreenFinal);
  analogWrite(SecondRgbPin + 2, BlueFinal);

  byte
  RedSecondFinal = RedFinal;

  byte
  GreenSecondFinal = GreenFinal;

  byte
  BlueSecondFinal = BlueFinal;

}
if (ColorSwitch = 2) {
  analogWrite(ThirdRgbPin, RedFinal);
  analogWrite(ThirdRgbPin + 1, GreenFinal);
  analogWrite(ThirdRgbPin + 2, BlueFinal);

  byte
  RedThirdFinal = RedFinal;

  byte
  GreenThirdFinal = GreenFinal;

  byte
  BlueThirdFinal = BlueFinal;

}

AutosaveOn = 1;
}

void Autosave() {
  //svetla
  EEPROM.update(Pamet, RedTvFinal);
  EEPROM.update(Pamet - 1, GreenTvFinal);
  EEPROM.update(Pamet - 2, BlueTvFinal);
  EEPROM.update(Pamet - 3, RedSecondFinal);
  EEPROM.update(Pamet - 4, GreenSecondFinal);
  EEPROM.update(Pamet - 5, BlueSecondFinal);
  EEPROM.update(Pamet - 6, RedThirdFinal);
  EEPROM.update(Pamet - 7, GreenThirdFinal);
  EEPROM.update(Pamet - 8, BlueThirdFinal);
  EEPROM.update(Pamet - 9, ColorSwitchButton);







}

void AutosaveRead() {
  //svetla
  RedTvFinal = EEPROM.read(Pamet);
  GreenTvFinal = EEPROM.read(Pamet - 1);
  BlueTvFinal = EEPROM.read(Pamet - 2);
  RedSecondFinal = EEPROM.read(Pamet - 3);
  GreenSecondFinal = EEPROM.read(Pamet - 4);
  BlueSecondFinal = EEPROM.read(Pamet - 5);
  RedThirdFinal = EEPROM.read(Pamet - 6);
  GreenThirdFinal = EEPROM.read(Pamet - 7);
  BlueThirdFinal = EEPROM.read(Pamet - 8);
  ColorSwitchButton = EEPROM.read(Pamet - 9);







}

Error:

D:\2007b\Documents\Arduino\Arduino_Room_controller\Arduino_Room_controller.ino: In function 'void loop()':
Arduino_Room_controller:203:5: error: 'Color' was not declared in this scope
Color();
^~~~~
Arduino_Room_controller:216:7: error: 'Autosave' was not declared in this scope
Autosave();
^~~~~~~~
D:\2007b\Documents\Arduino\Arduino_Room_controller\Arduino_Room_controller.ino:216:7: note: suggested alternative: 'AutosaveOn'
Autosave();
^~~~~~~~
AutosaveOn
D:\2007b\Documents\Arduino\Arduino_Room_controller\Arduino_Room_controller.ino: At global scope:
Arduino_Room_controller:228:4: error: expected declaration before '}' token
}}
^
exit status 1
'Color' was not declared in this scope

At first I tried to fix it, but the error always appeared elsewhere so I don't know anymore. I know this program is not the best done but I am just learning. I also apologize for English, I don't speak much English

The easier you make it to read and copy your code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

It looks like lines like that have screwed your braces.

Please remember to use code tags when posting code

Thank you, I didn't know what to do anymore: D

I've never seen this programming "style" before. It's very wasteful

This is programming style "uneducated beginner" so sorry for how bad it looks (even though I didn't really understand what)

Have you tried Auto Format in the IDE ?

This is autoformated

The "problem" is already solved only I did not notice the banality

You should post code by using code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

best regards Stefan

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.