Sketch help

Hey everyone,

So Its been over 3 year now sense my initial project. I created a motorized dvd player for my SUV. The Sketch I have been using was working great until my Uno decided to stop working. No biggie I ordered a new one off Amazon plugged it into the computer and tried to load my 3 year old sketch. I am getting all kinds of errors. I haven’t touched or kept up with anything over this time and sure a lot has change/updated. I have searched a little for help and will continue until I can figure this out. If you have any input please let me know. Thanks

#include <avr/interrupt.h>
#include <avr/power.h>
#include <avr/sleep.h>
#include <SoftwareSerial.h>
#define Mtr 20000
#define AllOff 10000


SoftwareSerial BTserial(10, 11); // RX | TX

// max length of command is 20 chrs
const byte numChars = 20;
char receivedChars[numChars];
boolean newData = false;
boolean debug = true;

byte downBtn = 2;
byte upBtn = 3;
byte accpwr = 8;           
byte MtrUp = 7;
byte MtrDwn = 6;
byte Pwr1 = 5;
byte Pwr2 = 4;

int UpState = 0;
int DownState = 0;
int accs = 0;
int Pwr2s = 0;

void setup() {

  Serial.begin(9600);
  Serial.println(F("<Arduino is ready>"));
  BTserial.begin(9600);

  pinMode(accpwr, INPUT); //is car running
  pinMode(upBtn, INPUT);    //system off and screens up
  pinMode(downBtn, INPUT); //system on and screens down
  pinMode(13, OUTPUT);
  pinMode(MtrUp,OUTPUT); // motor on for up
  pinMode(MtrDwn,OUTPUT); //motor on for down
  pinMode(Pwr1,OUTPUT); // main relay 1
  pinMode(Pwr2,OUTPUT); //main relay 2
}

void loop() {

  digitalWrite(13, HIGH);
  UpState  =  digitalRead(upBtn);        
  DownState  =  digitalRead(downBtn);      
  accs = digitalRead(accpwr);
  Pwr2s = digitalRead(Pwr2);
  
  if (accs == HIGH && DownState == HIGH && Pwr2s == LOW) {
       ON();     // screens down and system on 
  }

    if (accs == HIGH && UpState == HIGH && Pwr2s == HIGH) {
       OFF();   // system off and screens up
  }
  
  if  (accs == LOW && Pwr2s == HIGH) {     
     AutoOFF(); // if car is off turn off system and screens up
   }


  if (DownState == LOW || UpState == LOW) {
    // sets relay 1/2 to off if not pressed:
    digitalWrite(MtrUp, LOW);
    digitalWrite(MtrDwn, LOW);
  }

  if (BTserial.available() > 0)     {
    recvWithStartEndMarkers();
  }

  if (newData) {
    parseData();
  }

  if (accs == LOW) {
    sleepNow();
  }
}

void parseData()
{
  newData = false;
  if (debug) {
    Serial.println( receivedChars );
  }
  if (receivedChars[0] == 'O'  && receivedChars[1] == 'N' && accs == HIGH && Pwr2s == LOW )  {

    ON();
  }

  if (receivedChars[0] == 'O'  && receivedChars[1] == 'F' && accs == HIGH && Pwr2s == HIGH )  {
    OFF();
  }
}

void ON() {
  BTserial.println("ON"); BTserial.print("##");
  if (debug) {
    Serial.println("ON");
  }
  digitalWrite(Pwr1, HIGH);
  digitalWrite(Pwr2, HIGH);
  digitalWrite(MtrDwn, HIGH);
  delay(Mtr);
}

void OFF() {
  BTserial.println("OFF"); BTserial.print("##");
  if (debug) {
    Serial.println("OFF");
  }
  digitalWrite(Pwr1, LOW);
  digitalWrite(MtrUp, HIGH);
  delay (Mtr);
  digitalWrite(Pwr2, LOW);
}

void AutoOFF() {
  delay(AllOff);
    accs = digitalRead (accpwr);
   if  (accs == LOW){ 
// make sure car is still off and then system off and screens up
  digitalWrite(Pwr1, LOW);
  digitalWrite(MtrUp, HIGH);
  delay (Mtr);
  digitalWrite(Pwr2, LOW);
  
  BTserial.println("OFF"); BTserial.print("##");

  if (debug)
  {
    Serial.println("OFF");
  }
  }
}


void recvWithStartEndMarkers()
{
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;

  if (BTserial.available() > 0)
  {
    rc = BTserial.read();
    if (recvInProgress == true)
    {
      if (rc != endMarker)
      {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else
      {
      receivedChars[ndx] ='\0';
       // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

void sleepNow(void) {
    
    // Choose our preferred sleep mode
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);

  // Enable interrupt
  attachInterrupt(0, rupt, HIGH);
  // pin 2
  attachInterrupt(1, rupt, HIGH);
  // pin 3

    // Set sleep enable (SE) bit:
    sleep_enable();

    digitalWrite(13, LOW);       // turn LED off to indicate sleep

    // Put the device to sleep:
    sleep_mode();

    // Upon waking up, sketch continues from this point.
    sleep_disable();
}

void rupt(void) {
  // just wake from sleep
}

It can be very useful to post the complete error message.

Possibly you bought a clone with CH340 chip (for the USB) and need drivers?
Or com port changed and you did not select the correct one?

Also while everything is apart I will be upgrading some parts so instead of using 2 relays to control my dc motor I have a motor controller and Also upgrading the Uno to a sparks fun Micro 3.3v. Well this will happen if I can figure out the first issue.

Your code compiles fine for me on IDE version 1.8.1 so it may be an issue with your board like sterretje suggested.

Arduino: 1.6.9 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\shane\AppData\Local\Arduino15\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\shane\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\shane\Documents\Arduino\libraries" -fqbn=arduino:avr:uno -ide-version=10609 -build-path "C:\Users\shane\AppData\Local\Temp\build138dbb015a461f39e1e08199eda5622c.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "E:\New folder\sketch\AcadiaDVD\AcadiaDVD.ino"
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\shane\AppData\Local\Arduino15\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\shane\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\shane\Documents\Arduino\libraries" -fqbn=arduino:avr:uno -ide-version=10609 -build-path "C:\Users\shane\AppData\Local\Temp\build138dbb015a461f39e1e08199eda5622c.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "E:\New folder\sketch\AcadiaDVD\AcadiaDVD.ino"
"C:\Users\shane\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\cores\arduino" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\variants\standard" "C:\Users\shane\AppData\Local\Temp\build138dbb015a461f39e1e08199eda5622c.tmp\sketch\AcadiaDVD.ino.cpp" -o "nul"
"C:\Users\shane\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\cores\arduino" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\variants\standard" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\libraries\SoftwareSerial\src" "C:\Users\shane\AppData\Local\Temp\build138dbb015a461f39e1e08199eda5622c.tmp\sketch\AcadiaDVD.ino.cpp" -o "nul"
"C:\Users\shane\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\cores\arduino" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\variants\standard" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\libraries\SoftwareSerial\src" "C:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\libraries\SoftwareSerial\src\SoftwareSerial.cpp" -o "nul"
"C:\Users\shane\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\cores\arduino" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\variants\standard" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\libraries\SoftwareSerial\src" "C:\Users\shane\AppData\Local\Temp\build138dbb015a461f39e1e08199eda5622c.tmp\sketch\AcadiaDVD.ino.cpp" -o "nul"
"C:\Users\shane\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\cores\arduino" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\variants\standard" "-IC:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\libraries\SoftwareSerial\src" "C:\Users\shane\AppData\Local\Temp\build138dbb015a461f39e1e08199eda5622c.tmp\sketch\AcadiaDVD.ino.cpp" -o "C:\Users\shane\AppData\Local\Temp\build138dbb015a461f39e1e08199eda5622c.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
AcadiaDVD:1: error: #include expects "FILENAME" or <FILENAME>

 #include <avr/interrupt.h>

         ^

AcadiaDVD:2: error: #include expects "FILENAME" or <FILENAME>

 #include <avr/power.h>

         ^

AcadiaDVD:3: error: #include expects "FILENAME" or <FILENAME>

 #include <avr/sleep.h>

         ^

Using library SoftwareSerial at version 1.0 in folder: C:\Users\shane\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.18\libraries\SoftwareSerial 
exit status 1
#include expects "FILENAME" or <FILENAME>

Hum I will have to look into it more tomorrow. I have the right board selected and its not a clone. Could be a wrong file path for the #includes? I found them in the AVR folder but not listed in the included library tab.

Where did the capital A with a circumflex after the #include come from?

Copy the sketch that you posted (from this forum) into a new sketch. As @saximus said, your code does compile.