user47357: When I compile my program I get an error message saying redefinition of "..." on every single line, of every variable, class, function, etc.
What am I doing wrong?
int incomingByte = 0;   // for incoming serial data

int byteCount = 0;

bool decision = false;

bool last_debounce = false;

bool test_running = false;

bool ready_freq_enable = false;

int cur_cavity_address = 0;

char serBuffer[256] = {0};

unsigned long previousMillis_enable = 0;
const long interval_online = 1000 / 100;

unsigned long previousMillis_debounce = 0;
const long interval_debounce = 50;

void setup() {
  // put your setup code here, to run once:
 /* pinMode(22, OUTPUT);//address bit 1
  pinMode(24, OUTPUT);//address bit 2
  pinMode(26, OUTPUT);//address bit 3

  pinMode(36, INPUT);

  pinMode(40, OUTPUT);
  pinMode(48, OUTPUT);
  pinMode(52, OUTPUT);*/


  pinMode(2, OUTPUT);//address bit 1
  pinMode(3, OUTPUT);//address bit 2
  pinMode(4, OUTPUT);//address bit 3

  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);

  pinMode(10, INPUT);

  Serial.begin(9600);
}

int seekChar(char c){
  for (int x = 0; x < 256; x++) {
    if (serBuffer[x] == c){
      return x;
    }
  }
  return -1;
}

void return_error(){
  Serial.println("ERROR!");
}

void loop() {
  if (Serial.available() > 0) {
          // read the incoming byte:
         int incomingByte = Serial.read();
          serBuffer[byteCount] = incomingByte;
          byteCount++;

          if (serBuffer[strlen(serBuffer)-1] == '\r'){
            serBuffer[strlen(serBuffer)-1] = 0; //remove the last carriage return

            int charIdx = seekChar(' ');
            char value[32] = {0};
            byteCount = 0;
            Serial.flush();

            if (charIdx != -1){
              memcpy(value, serBuffer + charIdx + 1, sizeof(value));
              memset(serBuffer + charIdx, 0, sizeof(serBuffer) - charIdx);
            }

            if (strcmp(serBuffer, "run") == 0){
              if (ready_freq_enable == true){
                test_running = strcmp(value, "true") == 0;
                if (test_running){
                  decision = 0;
                }
              } else {
                return_error();
              }

            } else if (strcmp(serBuffer, "reset") == 0){
              cur_cavity_address = 0;
              decision = false;
            } else if (strcmp(serBuffer, "decision") == 0){
              decision = strcmp(value, "true") == 0;
            } else if (strcmp(serBuffer, "enable") == 0){
              ready_freq_enable = strcmp(value, "true") == 0;

            } else if (strcmp(serBuffer, "address") == 0){
              if (abs(atoi(value)) > 8){
                return_error();
              } 
              cur_cavity_address = abs(atoi(value));
            }

            memset(serBuffer, 0, sizeof(serBuffer));
            memset(value, 0, sizeof(value));

          }
  }

  test_running &= ready_freq_enable;
  update_io();
  check_status();
}


void check_status(){
  unsigned long currentMillis = millis();
  bool new_debounce =  digitalRead(10);
  if (new_debounce != last_debounce){

    if (currentMillis - previousMillis_debounce >= interval_debounce) {

    // save the last time you blinked the LED
      previousMillis_debounce = currentMillis;

      Serial.print( new_debounce );
      last_debounce = new_debounce;
    }

  } else {
    previousMillis_debounce = currentMillis;
  }
}


void update_io(){
  //digitalWrite(48, !digitalRead(48) );

  digitalWrite(7, test_running);

  digitalWrite(3, (cur_cavity_address & 0b001) != 0);
  digitalWrite(2, (cur_cavity_address & 0b010) != 0);
  digitalWrite(4, (cur_cavity_address & 0b100) != 0);

  unsigned long currentMillis = millis();
  //Serial.println(ready_freq_enable);
  if (currentMillis - previousMillis_enable >= interval_online) {
    // save the last time you blinked the LED
    previousMillis_enable = currentMillis;
    digitalWrite(5, !digitalRead(5) & ready_freq_enable);
    if (ready_freq_enable == false){
      cur_cavity_address = 0;
    }
  }

  digitalWrite(6, decision & ready_freq_enable);
}


user47357: Apparently I had a duplicate ino file on my same folder. Must of happened accidentally when I was creating a copy as backup. Thanks Chris!

47357: <p>When I compile my program I get an error message saying redefinition of "..." on every single line, of every variable, class, function, etc.</p>

<p>What am I doing wrong?</p>

<pre><code>int incomingByte = 0;   // for incoming serial data

int byteCount = 0;

bool decision = false;

bool last_debounce = false;

bool test_running = false;

bool ready_freq_enable = false;

int cur_cavity_address = 0;

char serBuffer[256] = {0};

unsigned long previousMillis_enable = 0;
const long interval_online = 1000 / 100;

unsigned long previousMillis_debounce = 0;
const long interval_debounce = 50;

void setup() {
  // put your setup code here, to run once:
 /* pinMode(22, OUTPUT);//address bit 1
  pinMode(24, OUTPUT);//address bit 2
  pinMode(26, OUTPUT);//address bit 3

  pinMode(36, INPUT);

  pinMode(40, OUTPUT);
  pinMode(48, OUTPUT);
  pinMode(52, OUTPUT);*/


  pinMode(2, OUTPUT);//address bit 1
  pinMode(3, OUTPUT);//address bit 2
  pinMode(4, OUTPUT);//address bit 3

  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);

  pinMode(10, INPUT);

  Serial.begin(9600);
}

int seekChar(char c){
  for (int x = 0; x &lt; 256; x++) {
    if (serBuffer[x] == c){
      return x;
    }
  }
  return -1;
}

void return_error(){
  Serial.println("ERROR!");
}

void loop() {
  if (Serial.available() &gt; 0) {
          // read the incoming byte:
         int incomingByte = Serial.read();
          serBuffer[byteCount] = incomingByte;
          byteCount++;

          if (serBuffer[strlen(serBuffer)-1] == '\r'){
            serBuffer[strlen(serBuffer)-1] = 0; //remove the last carriage return

            int charIdx = seekChar(' ');
            char value[32] = {0};
            byteCount = 0;
            Serial.flush();

            if (charIdx != -1){
              memcpy(value, serBuffer + charIdx + 1, sizeof(value));
              memset(serBuffer + charIdx, 0, sizeof(serBuffer) - charIdx);
            }

            if (strcmp(serBuffer, "run") == 0){
              if (ready_freq_enable == true){
                test_running = strcmp(value, "true") == 0;
                if (test_running){
                  decision = 0;
                }
              } else {
                return_error();
              }

            } else if (strcmp(serBuffer, "reset") == 0){
              cur_cavity_address = 0;
              decision = false;
            } else if (strcmp(serBuffer, "decision") == 0){
              decision = strcmp(value, "true") == 0;
            } else if (strcmp(serBuffer, "enable") == 0){
              ready_freq_enable = strcmp(value, "true") == 0;

            } else if (strcmp(serBuffer, "address") == 0){
              if (abs(atoi(value)) &gt; 8){
                return_error();
              } 
              cur_cavity_address = abs(atoi(value));
            }

            memset(serBuffer, 0, sizeof(serBuffer));
            memset(value, 0, sizeof(value));

          }
  }

  test_running &amp;= ready_freq_enable;
  update_io();
  check_status();
}


void check_status(){
  unsigned long currentMillis = millis();
  bool new_debounce =  digitalRead(10);
  if (new_debounce != last_debounce){

    if (currentMillis - previousMillis_debounce &gt;= interval_debounce) {

    // save the last time you blinked the LED
      previousMillis_debounce = currentMillis;

      Serial.print( new_debounce );
      last_debounce = new_debounce;
    }

  } else {
    previousMillis_debounce = currentMillis;
  }
}


void update_io(){
  //digitalWrite(48, !digitalRead(48) );

  digitalWrite(7, test_running);

  digitalWrite(3, (cur_cavity_address &amp; 0b001) != 0);
  digitalWrite(2, (cur_cavity_address &amp; 0b010) != 0);
  digitalWrite(4, (cur_cavity_address &amp; 0b100) != 0);

  unsigned long currentMillis = millis();
  //Serial.println(ready_freq_enable);
  if (currentMillis - previousMillis_enable &gt;= interval_online) {
    // save the last time you blinked the LED
    previousMillis_enable = currentMillis;
    digitalWrite(5, !digitalRead(5) &amp; ready_freq_enable);
    if (ready_freq_enable == false){
      cur_cavity_address = 0;
    }
  }

  digitalWrite(6, decision &amp; ready_freq_enable);
}
</code></pre>
 47357: <p>Apparently I had a duplicate ino file on my same folder. Must of happened accidentally when I was creating a copy as backup. Thanks Chris!</p>
