Skip to content

Sketch where Read characteristics don't work #568

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

Open
crfrancis opened this issue Aug 20, 2017 · 2 comments
Open

Sketch where Read characteristics don't work #568

crfrancis opened this issue Aug 20, 2017 · 2 comments

Comments

@crfrancis
Copy link

I've attached a sketch, which is a cut-down version of one I'm working on. It sets one service with 5 characteristics: one write, 2 notify and 2 read. The write and notify ones work as expected, but not the reads.
If I upload this to a fresh Arduino 101, with the "101 Firmware Updater" programmer, it flashes the new firmware (with the 2.0.2 board manager). Then with LightBlue on the iPhone I can see the device, the service and the characteristics, but I can't read the 2 read values. The same with my own C++ code on an R-Pi (BlueZ 5.46 installed).
I have another sketch with 3 characteristics, and that works properly.
cheers,
Richard

LasersRemote30debug.zip

@crfrancis
Copy link
Author

I've been working on this issue for weeks now, but today made a breakthrough, with a reproducible cause.

It's the analogRead() which is to blame. I tried all 6 pins and the result is the same. Reading the characteristic doesn't work.

But if you comment out the call to readLaserVoltage() in the example I posted, the problem goes away.

cheers,
Richard

@crfrancis
Copy link
Author

Here is an update to the sketch which demonstrates the problem. It has 37 lines. Using, for example, LightBlue on an iPhone reveals the problem.
Commenting out line 35
laserVolts = analogRead(VOLTS_PIN); // try commentinng out this line
will stop the error.

cheers,
Richard

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

1 participant