Hi,
Im new to this so plz try to help me
Im trying to load a code that i found online that will dimm leds,
i want over the code and correct all the errors but i left with one error
in the rtc code.
im using Tiny rtc ds1307.
i’ve tried to run the only the rtc code but im still getting the same error:
error: expected declaration before ‘}’ token
i changed the { back and forward to try to solve this buy when
i change it im only get more errors.
thats the code for the rtc:
// include the libraries:
#include <LiquidCrystal.h>
#include <Wire.h>
#include <Button.h>
#include <EEPROM.h>
#include <EEPROMVar.h>
// set the RTC's I2C address
#define DS1307_I2C_ADDRESS 0x68
// Convert decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
return ( (val/10*16) + (val%10) );
}
// Convert binary coded decimal to decimal numbers
byte bcdToDec(byte val)
{
return ( (val/16*10) + (val%16) );
}
// Sets date and time, starts the clock
void setDate(byte second, // 0-59
byte minute, // 0-59
byte hour, // 1-23
byte dayOfWeek, // 1-7
byte dayOfMonth, // 1-31
byte month, // 1-12
byte year); // 0-99
}
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.read();
Wire.read(decToBcd(second));
Wire.read(decToBcd(minute));
Wire.read(decToBcd(hour));
Wire.read(decToBcd(dayOfWeek));
Wire.read(decToBcd(dayOfMonth));
Wire.read(decToBcd(month));
Wire.read(decToBcd(year));
Wire.endTransmission();
{
// Gets the date and time
void getDate(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year);
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.read(0);
Wire.endTransmission();
Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
*second = bcdToDec(Wire.read() & 0x7f);
*minute = bcdToDec(Wire.read());
*hour = bcdToDec(Wire.read() & 0x3f);
*dayOfWeek = bcdToDec(Wire.read());
*dayOfMonth = bcdToDec(Wire.read());
*month = bcdToDec(Wire.read());
*year = bcdToDec(Wire.read());
}
plz help me find what is wrong in this code.