Poner la hora por programa no a traves del puerto usb

Hola el siguiente programa del reloj, es el de la web cel producto grove.. Mi intencion es configurar la hora del reloj por el programa no atraves del puerto serie escriviendo T000.... i la hora dia mes i año que es como se hace en el programa de la web, pero no veo la forma de programar a traves del lenguage de programacion la hora dia... del reloj. Si escribo hour=17 scond=00; se muestra ese valor pero no canvia alguien sabe como modificar el programa para no ajustar la hora a traves del puerto usb?
Espero que se haya entendido. Gracias por adelantado.

Atentamente Albert Boix

#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68 // This is the I2C address
// Global Variables
int command = 0; // Aquest és l'ordre tar, en format ASCII, enviats des del port sèrie
int i;
long previousMillis = 0; // Emmagatzema Temps última vegada que es va actualitzar
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
byte test;

// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
return ( (val/10*16) + (val%10) );
}

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

// 1) Sets the date and time on the ds1307
// 2) Starts the clock
// 3) Sets hour mode to 24 hour clock
// Assumes you're passing in valid numbers, Probably need to put in checks for valid numbers.

void setDateDs1307()
{

second = (byte) ((Serial.read() - 48) * 10 + (Serial.read() - 48)); // Use of (byte) type casting and ascii math to achieve result.
minute = (byte) ((Serial.read() - 48) *10 + (Serial.read() - 48));
hour = (byte) ((Serial.read() - 48) *10 + (Serial.read() - 48));
dayOfWeek = (byte) (Serial.read() - 48);
dayOfMonth = (byte) ((Serial.read() - 48) *10 + (Serial.read() - 48));
month = (byte) ((Serial.read() - 48) *10 + (Serial.read() - 48));
year= (byte) ((Serial.read() - 48) *10 + (Serial.read() - 48));
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0x00);
Wire.write(decToBcd(second)); // 0 to bit 7 starts the clock
Wire.write(decToBcd(minute));
Wire.write(decToBcd(hour)); // If you want 12 hour am/pm you need to set
// bit 6 (also need to change readDateDs1307)
Wire.write(decToBcd(dayOfWeek));
Wire.write(decToBcd(dayOfMonth));
Wire.write(decToBcd(month));
Wire.write(decToBcd(year));
Wire.endTransmission();
}

// Gets the date and time from the ds1307 and prints result
void getDateDs1307()
{
// Reset the register pointer
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0x00);
Wire.endTransmission();

Wire.requestFrom(DS1307_I2C_ADDRESS, 7);

// A few of these need masks because certain bits are control bits
second = bcdToDec(Wire.read() & 0x7f);
minute = bcdToDec(Wire.read());
hour = bcdToDec(Wire.read() & 0x3f); // Need to change this if 12 hour am/pm
dayOfWeek = bcdToDec(Wire.read());
dayOfMonth = bcdToDec(Wire.read());
month = bcdToDec(Wire.read());
year = bcdToDec(Wire.read());

Serial.print(hour, DEC);
Serial.print(":");
Serial.print(minute, DEC);
Serial.print(":");
Serial.print(second, DEC);
Serial.print(" ");
Serial.print(dayOfMonth, DEC);
Serial.print("/");
Serial.print(month, DEC);
Serial.print("/");
Serial.print(year, DEC);
Serial.print(" ");
}
void setup() {
Wire.begin();
Serial.begin(57600);
}
void loop() {
delay(2000);
/*T(00-59)(00-59)(00-23)(1-7)(01-31)(01-12)(00-99) - T(sec)(min)(hour)(dayOfWeek)(dayOfMonth)(month)(year) - T Sets the date of the RTC DS1307 Chip.
Example to set the time for 02-DEC-10 @ 19:57:11 for the 3 day of the week, write this command - T1157193021210
*/
if (Serial.available())
{ // Look for char in serial que and process if found
command = Serial.read();
if (command == 84) { //If command = "T" Set Date
setDateDs1307();
getDateDs1307();
Serial.println(" ");
}
while(1)
{
getDateDs1307();
delay(500);
}
}
}

Mi intencion es configurar la hora del reloj por el programa no atraves del puerto serie escriviendo T000

te das cuenta que si haces esto cada vez que reinicies el arduino se pondra la hora programada por primera vez?

Si se que se reiniciara cada vez a la hora pero mi intencion es ponerla a traves de una tft 2,8"Touch, si se ajustar la hora por programa sabre hacerlo a traves de la tft que es mi intencion. Prove el enlace pero me sale que esta roto.
Gracias por adelantado.

a que te refieres con que no cambia?
pon tu codigo modificado

Hola,

no veo qué problema tienes para asignar directamente los valores a las variables: poniendo "hour=17;" debería de funcionarte.

Mira esta librería, la hora se pone como tú deseas:
http://www.carballada.com/wordpress/wp-content/uploads/rtcds1307.zip