UPDATE:
i read all the comments took bits and pieces out of everyones comment and came up with this
code:
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
}
void loop() {
Wire.beginTransmission(0x68); //address
Wire.write(0x00); //register the next ones are going to be automatically selected apparently
Wire.endTransmission();
Wire.requestFrom(0x68, 7);
Serial.print(bcdToDec(Wire.read() & 0x7f));
Serial.print(" seconds, ");
Serial.print(bcdToDec(Wire.read()));
Serial.print(" minutes, ");
Serial.print(bcdToDec(Wire.read() & 0x3f));
Serial.print(" hours, ");
Serial.print(bcdToDec(Wire.read()));
Serial.print(" day of week, ");
Serial.print(bcdToDec(Wire.read()));
Serial.print(" day, ");
Serial.print(bcdToDec(Wire.read()));
Serial.print(" month, ");
Serial.print(bcdToDec(Wire.read())+2000);
Serial.println(" year");
delay(1000);
};
byte bcdToDec(byte val)
{
return ( (val/16*10) + (val%16) );
};
However i am still not sure what this "0x7f" and "0x3f" mean.
my mistakes in previous code according to me:
1-I did not make that bcdToDec function which could convert the values to dec
and a little itsy bitsy mistakes here and there XD
This is the minimum that i could make it. but it still uses 6,148 bytes of the total 28kb(using leonardo) memory. with this pattern i do not think i will be able to write all of my code inside it. there must be some tricks to it... cause i saw a 300 to 400 line code that used only 28kb mines going to be smaller but i have to learn how to do that.
Again Thanks all!
How ever i still do not