Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heartrate Example issue #177

Open
lidiyag opened this issue Jul 21, 2023 · 1 comment
Open

Heartrate Example issue #177

lidiyag opened this issue Jul 21, 2023 · 1 comment

Comments

@lidiyag
Copy link

lidiyag commented Jul 21, 2023

I am new to tinygo-org/bluetooth package.
I tried to run the heartrate example in the repo.

My setup is as follows:

  1. Peripheral device(Ubuntu Laptop)
    https://github.com/tinygo-org/bluetooth/blob/release/examples/heartrate/main.go
    I ran this code as the peripheral

  2. Central device(Mac Laptop)
    https://github.com/tinygo-org/bluetooth/blob/release/examples/heartrate-monitor/main.go
    I ran this code as my central device

I could identify from logs that the scanning and connection to peripheral was successful. Also the central discovered the service and characteristic successfully.

I could verify the peripheral is writing successfully to the characteristic as well. But unfortunately, I am not able to receive any notifications on the central.

// Enable notifications for the characteristic

errEnable := char.EnableNotifications(func(buf []byte) {
	println("data:", uint8(buf[1])))
})
if errEnable != nil {
	println("Enable Error", errEnable)
} else {
	println("Enabling notfcns on char is success")
}

The enable notification was successful, but it never printed the data on central side.

I also tried reading the characteristic by adding bluetooth.CharacteristicReadPermission on peripheral and the following code in central

    dataRead := make([]byte, 2)
len, errRead := char.Read(dataRead)
println("Length of char data read", len)
println("data:", int(dataRead[1]))
println("Error on Data Read", errRead.Error())

This mostly errored with a timeout error on read. It gave me data only once.
Can someone help me in to figure out why this is happening?

@deadprogram
Copy link
Member

Sounds like the same change as #182 might address this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants