if(Temperature_value > 75)
Temperature_value = 25;
/* Update attribute data base */
ble_status = at_ble_characteristic_value_set(\
environment_service_characs[0].char_val_handle,\
(uint8_t *)&Temperature_value,\
sizeof(Temperature_value));
ble_status = at_ble_notification_send(0,\
environment_service_characs[0].char_val_handle);
if(ble_status != AT_BLE_SUCCESS){
printf("fail to send temperature update notification ");
}
}
6.
Add the following code in main routine to send temperature data every 10 seconds.
while (1) {
ble_event_task();
if(connected_flag == true && timer_flag == true{
timer_flag = false;
send_temperature_notification();
}
}
7.
Click "
" to save the project <Ctrl+S>.
8.
Compile the project by pressing the "
" button <F7>.
9.
Verify that no build error appears in Atmel Studio output window.
Figure 5-8. Atmel Studio Output Window
10. Click "
" to program the project binary on the L21 Xplained XSTK.
11. Open “Microchip SmartConnect” Application on Android or iOS device.
12. Connect and pair to the peripheral (pass key: 123456).
13. Click
NOTIFY
to start the notification.
14. Temperature information in HEX values must be displayed in Microchip SmartConnect application.
ATBTLC1000
Setting up and Handling Custom Service
©
2017 Microchip Technology Inc.
Training Manual
DS00002599A-page 45