Reading I2C sensor data over bluetooth on mobile applications.
Hello, I have recently started coding and learning C language. I implemented VL53L1X drivers to my NUCLEO-WB15CC and I am able to get measurements over USART communication. However, I would like to get these measurement results over Bluetooth and I would like to start and/or cancel the measurements from my phone by using some characteristic values. For example, when I write 0x1, the measurement should start and when I write 0x0 the measurement should stop. I am trying to build this behavior on top of P2PServer example provided by ST in STM32Cube_FW_WB_V1.13.0. I am not really sure where should I start implementing this behavior. I have started reading AN5289 document along with the P2PServer codes and I am kind of lost. If you have any tips or recommendations for me please help me, I will be so grateful. Thanks.
Edit: Here is my main.c, I want to implement the characteristic value scenario to my if statement at line 8. Then, I want to control the start of the measurements without a button and by writing to a characteristic.
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
//B2 pin is connected via internal pull up resistor
buttonisPressed = HAL_GPIO_ReadPin(B2_GPIO_Port, B2_Pin);
if(!(buttonisPressed == 1)){
HAL_Delay(200);
vl53l1x_get_measurement();
}
}
/* USER CODE END 3 */