Tick Tock Shield Kit - unable to set clock

I recently put together this kit. It ran all the demo programs fine except Demo 7, Real Time Clock. The clock seems to be working but I have not been able to set the time. This is the procedure I used:

  1. Press the K3 (Menu) key until the LCD displays the minute (:XX). The D2 LED is also on.
  2. Press the K2 (increase) key to set the minute. The LED display does not change and the buzzer beeps with each press of K2.
  3. Repeat steps 1 and 2 for all remaining settings.
  4. When the LED displays the time again, it has not changed.
    Question: When I press the K2 key, should the number on the LED display increments?
    Since the LED does not change, what may be the problem? I have the Tick Tock kit plugged into an Uno board.

I have run the program with DEBUG enabled. Here is the serial output when I tried to set the clock. It looks like I never received the CONFIRM system status after pressing the KEY UP a couple of times.
alarm = 11 : 2system_status = 1
Key_Menu pressed
Key_Menu release
Key_UP pressed
Key_UP pressed
Key_UP pressed
Key_UP pressed
Key_UP pressed
Key_UP pressed
system_status = 2
Key_Menu pressed
Key_Menu release
Key_UP pressed
Key_UP pressed
Key_UP pressed
system_status = 3
Key_Menu pressed
Key_Menu release
Key_UP pressed
Key_UP pressed
Key_UP pressed
system_status = 4
Key_Menu pressed
Key_Menu release
Key_UP pressed
system_status = 5
Key_Menu pressed
Key_Menu release
Key_UP pressed
Key_UP pressed
system_status = 6
Key_Menu pressed
Key_Menu release
system_status = 7

Hi,

Please change the following function in the TickShield.cpp file

[code]int16_t TickShield::scanKey()
{
int16_t pin_number = 0;
static boolean pre_key_menu_level = HIGH;
boolean cur_key_menu_level;
if(digitalRead(KEY_MENU) == LOW)
{
delay(30);
if(digitalRead(KEY_MENU) == LOW)
{
cur_key_menu_level = LOW;
pin_number = KEY_MENU;
}
else cur_key_menu_level = HIGH;
}
else
{
cur_key_menu_level = HIGH;
}
if(pre_key_menu_level > cur_key_menu_level)
{

	key_menu_status = KEY_PRESSED;
	if(system_status < 9)system_status ++;
	count_10ms_pressed = 0;
	flag_pressed_3s = 0;
#ifdef DEBUG
	Serial.print("system_status = ");
  Serial.println(system_status);
	Serial.println("Key_Menu pressed");
#endif
}
else if(pre_key_menu_level < cur_key_menu_level)
{
	key_menu_status = KEY_RELEASE;
	count_10ms_release = 0;
	flag_release_10s = 0;
#ifdef DEBUG
	Serial.println("Key_Menu release");

#endif
}
pre_key_menu_level = cur_key_menu_level;

if(digitalRead(KEY_UP) == LOW)
{
	delay(20);
	if(digitalRead(KEY_UP) == LOW)
	{
		pin_number = KEY_UP;
		count_10ms_release = 0;
		flag_release_10s = 0;
	#ifdef DEBUG
		Serial.println("Key_UP pressed");
	#endif
	}
	
}
else if(digitalRead(KEY_DOWN) == LOW)
{
	delay(20);
	if(digitalRead(KEY_DOWN) == LOW)
	{
		pin_number = KEY_DOWN;
		count_10ms_release = 0;
		flag_release_10s = 0;
	#ifdef DEBUG
		Serial.println("KEY_DOWN pressed");
	#endif
	}
}
if(pin_number == 0)pin_number = -1;
key_pin_pressed = pin_number;
return key_pin_pressed;

}
[/code]

and let us know if you have any other issue.

Thanks and Regards

The code is actually working except that there are multiple key entries accepted as seen in the trace in my earlier posting. By changing the delay to 300 from 20 and 30, only one key entry is seen with each key press. Also the code commented out the update of the display. By uncommenting that line, the display is now updated as the key is pressed. Also I have issue with the code that is supposed to toggle the alarm enable when S2 is pressed. The bitwise operator (~) used in the code does not seem to work. By changing it to set the alarm enable flag to 1 or 0 corrects the problem.