Page 1 of 1

Question about bluetooth

Posted: Tue May 22, 2018 12:13 pm
by 0romis
On request from a client I want to send data from a sensor over bluetooth. The sensor uses I2C. Im quite new to programming embedded systems. I was thinking to run the bluetooth and the i2c in their own threads do you think this is a good idea or is it unnecessary?

Re: Question about bluetooth

Posted: Wed May 23, 2018 9:09 pm
by kolban
I'm afraid its too broad a question to give you much in the way of experience or advice. One usually performs multi-threaded work because it offers better utilization of the device. For example while thread A is blocked I can be doing work on thread B. However adding threading for the sake of threading can introduce design complexity and errors. Assuming that the ESP32 is the I2C master and is polling the I2C sensor slave, what would be the negative effect of blocking waiting for a BLE response longer than how often you read from the sensor. For example, if a BLE call takes 50 msecs and you normally poll the sensor every 10msecs ... what does that mean to your overall solution? If the answer is nothing ... then maybe multi-threading isn't needed?

Re: Question about bluetooth

Posted: Thu May 24, 2018 8:38 am
by 0romis
Thanks for your answer this makes sense and will help me with my project. :)