Please can you fix this code :P i am not a programmer.

Hi, please can someone load this into arduino editor and fix it. I am not a programmer and this is not my code but i need it for a part of a project. Please message me or re-upload the corrected code. The issue seems to be

/tmp/801788748/ASAS_final_project_code_NEEDS_TEXTING/ASAS_final_project_code_NEEDS_TEXTING.ino:20:9: error: #include expects "FILENAME" or

#include

^

exit status 1

Here is the code :

/*

  • @name: SoundControl
  • @auth: John Kovacs
  • @date: 9 September 2016
  • This program is used to control the outdoor speakers of KMNR.
  • From 10a to 8p, we run the speakers at full volume.
  • Past 8p, we attenuate the signal using a voltage divider. One of the
  • resistors is a digital potentiometer controlled via SPI.
  • We use the ds1307 RTC to get time and date. Battery should last at least 17 years.
  • The ds1307 communicates over I2C.
  • The Status LED indicates when the device is running at full volume.

*/

#include
#include

byte clockAddress = 0x68; // I2C address for RTC
byte potAddress = 0x00; // SPI address for pots

byte CS = 10; // chip select, active low
byte STATUS_LED = 8;

byte HIGH_OUT = 100; // high resistance value (10k ohms / 128 )
byte LOW_OUT = 10; // low resistance value

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

////////////////////////////////////////////////////////////////////
// @name: bcdToDec()
// @desc: Convert binary coded decimal to normal decimal numbers
////////////////////////////////////////////////////////////////////
byte bcdToDec(byte val)
{
return ( (val/16*10) + (val%16) );
}

////////////////////////////////////////////////////////////////////
// @name: getDateDs1307()
// @desc: Gets the date and time from the ds1307 and stores it
// to global variables
////////////////////////////////////////////////////////////////////
void getDateDs1307() {
// Reset the register pointer
Wire.beginTransmission(clockAddress);
Wire.write(byte(0x00));
Wire.endTransmission();

Wire.requestFrom(int(clockAddress), 7);

// A few of these need masks because certain bits are control bits
second = bcdToDec(Wire.read() & 0x7f);
minute = bcdToDec(Wire.read());

// Need to change this if 12 hour am/pm
hour = bcdToDec(Wire.read() & 0x3f);
dayOfWeek = bcdToDec(Wire.read());
dayOfMonth = bcdToDec(Wire.read());
month = bcdToDec(Wire.read());
year = bcdToDec(Wire.read());

}

////////////////////////////////////////////////////////////////////
// @name: digitalPotWrite()
// @desc: sends a byte value to the 10kohm pots
// 0 = 0 ohms, 128 = 10k ohms
////////////////////////////////////////////////////////////////////
int digitalPotWrite(byte value)
{
digitalWrite(CS, LOW);
SPI.transfer(potAddress);
SPI.transfer(value);
digitalWrite(CS, HIGH);
}

////////////////////////////////////////////////////////////////////
// @name: setup()
// @desc: runs once at startup
////////////////////////////////////////////////////////////////////
void setup() {
pinMode(STATUS_LED, OUTPUT);
pinMode(CS, OUTPUT);
Wire.begin();
SPI.begin();
}

////////////////////////////////////////////////////////////////////
// @name: loop()
// @desc: runs continously
////////////////////////////////////////////////////////////////////
void loop() {

getDateDs1307();

// if time is past the start time and before the end time
if( hour >= 10 & hour < 20 ) {
digitalPotWrite(HIGH_OUT); // then turn up the volume!
digitalWrite(STATUS_LED, HIGH);
}
else {
digitalPotWrite(LOW_OUT); // else, turn down the volume
digitalWrite(STATUS_LED, LOW);
}

delay(300000); // run every 5 minutes
}

Thanks, Jacob xx

The issue seems to be

/tmp/801788748/ASAS_final_project_code_NEEDS_TEXTING/ASAS_final_project_code_NEEDS_TEXTING.ino:20:9: error: #include expects "FILENAME" or

#include

^

How could the message possibly be any clearer? You use #include to include some file. To do that, you can not expect the compiler to guess which file you want to include. If you don't want to include a file, you don't use #include. You do NOT just leave out the file name.

You're missing a couple of filenames

Because they're missing, we don't know what they should be.

Guessing "<Wire.h> and "<SPI.h>"

Please remember to use code tags when posting code

Thank you for your help i managed to fix this issue:

Next i am receiving the error "Wire" was not delcared int his scope. I am slightly confused by this as i though it was.

file is attached

sketch_dec12a.ino (3.18 KB)

I am slightly confused by this as i though it was.

Read through your code. Where did you tell the compiler what a Wire object is?

Normally, you'd tell the compiler that by using

#include "Wire.h"

or

#include <Wire.h>