FilipeSantos
Member
- Joined
- May 27, 2019
- Messages
- 12
- Programming Experience
- 1-3
Hello,
Am new here!
Need help on building a windows app to read a Polar H10 HR measure band.
Am starting by using this code; Bluetooth Generic Attribute Profile - Heart Rate Service.zip
Sample app reads HR and presents values to a window as bar chart and listbox.
I need to export the readings to a TXT file or even a virtual com port.
Anyways, not even a text file creation/appending am being successful
My knowledge about C# is very low...
My code below. Can anyone help out?
All and any ideas would be greatly appreciated.
Thank you!
Am new here!
Need help on building a windows app to read a Polar H10 HR measure band.
Am starting by using this code; Bluetooth Generic Attribute Profile - Heart Rate Service.zip
Sample app reads HR and presents values to a window as bar chart and listbox.
I need to export the readings to a TXT file or even a virtual com port.
Anyways, not even a text file creation/appending am being successful
My knowledge about C# is very low...
My code below. Can anyone help out?
All and any ideas would be greatly appreciated.
Thank you!
async void Instance_ValueChangeCompleted:
private async void Instance_ValueChangeCompleted(HeartRateMeasurement heartRateMeasurementValue)
{
// Serialize UI update to the the main UI thread.
await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
statusTextBlock.Text = "Latest received heart rate measurement: " +
heartRateMeasurementValue.HeartRateValue;
#if WINDOWS_APP
outputDataChart.PlotChart(HeartRateService.Instance.DataPoints);
#endif
outputListBox.Items.Insert(0, heartRateMeasurementValue);
string path = @"C:\Users\eliseu.santos\Documents\file.txt";
// convert string to stream
byte[] byteArray = Encoding.UTF8.GetBytes(path);
MemoryStream stream = new MemoryStream(byteArray);
using (TextWriter tw = new StreamWriter(stream))
{
tw.WriteLine("The next line!");
tw.WriteLine(heartRateMeasurementValue.HeartRateValue);
//tw.Dispose();
}
});
}
Last edited: