 					//TRANSACTION_CONTINUE and TRANSACTION_COMPLETE
 					//all other ACI commands will have status code of ACI_STATUS_SCUCCESS for a successful command         
 
-					Serial.print("ACI Status of ACI Evt Cmd Rsp 0x");
+					Serial.print(F("ACI Status of ACI Evt Cmd Rsp 0x"));
 					Serial.println(aci_evt->params.cmd_rsp.cmd_status, HEX);           
-					Serial.print("ACI Command 0x");
-					Serial.println(aci_evt->params.cmd_rsp.cmd_opcode, HEX);          
-					Serial.println("Evt Cmd respone: Error. Arduino is in an while(1); loop");
-					while (1);
-				}        
+					Serial.print(F("ACI Command 0x"));
+					Serial.println(aci_evt->params.cmd_rsp.cmd_opcode, HEX);   
+					if(aci_evt->params.cmd_rsp.cmd_opcode == ACI_CMD_CHANGE_TIMING) {
+						switch(aci_evt->params.cmd_rsp.cmd_status) {
+							case ACI_STATUS_ERROR_REJECTED:
+							case ACI_STATUS_ERROR_BUSY:
+								break;
+							case ACI_STATUS_ERROR_INVALID_PARAMETER:
+							case ACI_STATUS_ERROR_INVALID_LENGTH:
+							case ACI_STATUS_ERROR_INVALID_DATA:
+								timing_change_done = true;
+								break;
+						}
+					}       
+				}  else {
+					Serial.println(F("ACI Status SUCCESSFUL"));
+					Serial.print(F("ACI Status of ACI Evt Cmd Rsp 0x"));
+					Serial.println(aci_evt->params.cmd_rsp.cmd_status, HEX);           
+					Serial.print(F("ACI Command 0x"));
+					Serial.println(aci_evt->params.cmd_rsp.cmd_opcode, HEX);  
+					timing_change_done = true;
+				}     
 				break;
 				
 			case ACI_EVT_PIPE_STATUS:
-				Serial.println("Evt Pipe Status");
+				Serial.println(F("Evt Pipe Status"));
 				/** check if the peer has subscribed to the Heart Rate Measurement Characteristic for Notifications
 				*/
 				if (lib_aci_is_pipe_available(&aci_state, PIPE_HEART_RATE_HEART_RATE_MEASUREMENT_TX) 

static bool radio_ack_pending  = false;
static bool timing_change_done = false;
static bool timing_high = false;
static uint8_t current_heart_rate_data[HR_MAX_PAYLOAD];

const int analogInPin = I0; 

int sensorValue = 200;

void setup(void)
{ 

						When the device is in the setup mode
						*/
						aci_state.device_state = ACI_DEVICE_SETUP;
						Serial.println(F("Evt Device Started: Setup"));
						if (ACI_STATUS_TRANSACTION_COMPLETE != do_aci_setup(&aci_state))
						{
							Serial.println(F("Error in ACI Setup"));
						}
						break;
						
						case ACI_DEVICE_STANDBY:
							aci_state.device_state = ACI_DEVICE_STANDBY;
							Serial.println(F("Evt Device Started: Standby"));
							lib_aci_connect(180/* in seconds */, 0x0100 /* advertising interval 100ms*/);
							Serial.println(F("Advertising started for 180s"));
							break;
					}
				}
