I am trying to understand how to get soil moisture from sensor, but I am not sure where to get soil sensor address. After SDK update there were some changes, and 64b device_address is now required. I tried to understand this example:
and I am confused where is device_address set. When you are calling the “soil_sensor_event_handler” there is no address in parameter…
I would like to use “bc_soil_sensor_get_moisture(self, device_address, &moisture)” function separately, but I don’t know where to get parameter “device_address”.
Thank you, I saw it before, but I thought that it is empty. In the event handler it is just initiated. When the function is called, there is not set this parameter (“bc_soil_sensor_set_event_handler(&soil_sensor, soil_sensor_event_handler, NULL);”). Or is it set by “something”? (where?)
When I would like to use the “bc_soil_sensor_get_moisture(self, device_address, &moisture)” function outside of event handler. Where I obtain the “device_address”, please?
I am sure that this is caused because my knowledge of C language is very poor, I am sorry… Lot of things I deducted from the code, but this is still confused for me…
Thank you very much! I used your exaple with multiple sensors (but I have array with only one sensor). Then it is possible to use function “bc_soil_sensor_get_device_address_by_index” and it works!!! Very interesting is, that value of device_address (in event handler function) is not same as result of bc_soil_sensor_get_device_address_by_index(self,0) but it also works. I don’t know why, but it works… device_address in event_handler function is changing sometimes. I thought that address is adress and it is still same for every device. Probably not, but when it is possible to use function which returns address by index, it is not problem.