Closed Dracula-101 closed 1 year ago
The issue is been solved. The main reason was the listen method being in the initstate, rather than it being in the Initstate, call the listen method in an onPressed or onTap method ( for some reason it does skip data).
I am working on health-related device which relies on getting the data from a piezoelectric sensor and transmitting the data through Arduino using the hc 05 module. The data transfer rate is exceptionally high (about 20 ms intervals) and I am getting values that have some skipped digits. I have made a wrapper class for sending and receiving data and also using special delimiters as data already to eliminate data arriving randomly.
Here is the methods of Bluetooth Class, I have used Provider for state management
This class only handles the sending the data and computeData(Uint8List data) method only sends the incoming data into buffer such that proper data manipulation can be done afterwards.
I am using a DataPoint class to store the points receiving from the sensor. The x value is the time in millisecond and y is the sensor value.
Below is the code when I convert the data coming from the Bluetooth into List and then convert it to a Datapoint Object
Data is in format : $(Value1)&(Value2) when sending from arduino
I have experimented with native android apps that have Bluetooth serial functionality, it works perfectly fine. Some values are getting skipped and some digits are missing from a certain value. Any help would be appreciated.