-
Notifications
You must be signed in to change notification settings - Fork 609
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
How to read from serial.print #151
Comments
The examples use a notification to get data written from the redbear lab board on the phone. You could use read, but notification usually better since you don't need to poll, you just get the data when it arrived. If you can get data from |
Nothing come out from startNotification. txCharacteristic has the same value with rxCharacteristic for bluno board rite? Neither success or failure functions are called. |
That's ok if TX and RX use the same characteristic. The bluno board will need to support notifications on that characteristic. For startNotification, you won't receive the success callback until the bluno sends data. The success callback will be called over and over every time data arrived from the bluno. Do you have the Bluno BLE service definition? Maybe there's another flow control characteristic or configuration that is necessary? |
Yup, i have the service definition too. here is the sketch from bruno board: unsigned char data;
void setup() {
Serial.begin(115200); //initial the Serial
}
void loop()
{
if (Serial.available()){
data = Serial.read();
Serial.write(data);
Serial.println();
if (data == 'a'){
Serial.print("Acknowledgement");
}
Serial.println(); //print line feed character
}
} It is able to output Serial.write(data); but not Serial.print("Acknowledgement"); when execute ble.write with the character 'a' |
I don't have the service definition or a bluno. Can you create a repo with your Arduino and Cordova code? I'll try and make another device work like the bleno. Also, are you running the latest bluno firmware? The wiki says there's a bug in old versions. |
Hi Don, this is the repo that based on one of the examples https://github.com/laics1984/redbearlab, with the sketch. I can retieve the value using bluetooth ble utility app on ios with service uuid DFB0 and characteristic uuid DFB1. |
Hi @don , anything wrong with my code? uuid? i hv yet to get it run.. guidance needed. Can you please help? Thanks. |
At first glance the Cordova code looks fine, since it's basically my example with the UUIDs changed. Unfortunately I can't run it since I don't have a Bluno. Maybe you need to do something different on the Arduino side? Are you running the latest Bluno firmware? See if you can get your example working with nRF Master Control Panel or LightBlue. If that doesn't work, talk to the Bluno people to see what they suggest. If you can get the code working with nRF Master Control Panel or LightBlue it should work with my plugin. |
I have some problem getting the bluno to enable notifications on serial port and I think it's a firmware issue: bluno serial service definition: According to BLE standard: descriptor 2902 MUST be present in order to be able to enable/disable notifications for a service, which is not the case and leads to error: error while starting notifications for service DFB0, characteristic DFB1: "Set notification failed for 0000dfb1-0000-1000-8000-00805f9b34fb" @don does it make sense? I can't get any other information from the error itself |
@cnadeau sounds like a peripheral issue. If the firmware update doesn't fix, create a new github issue, ideally with a test app. |
@cnadeau It looks like Bluno is still broken with firmware 1.96. The Client Characteristic Configuration descriptor (0x2902) is missing. It's not clear where to file the Bluno issue. |
Just saw you posted the issue here, just replied and we'll see where it leads us! http://www.dfrobot.com/forum/viewtopic.php?f=18&t=2035&p=9218#p9218 thanks a lot for your reply 👍 |
Any updates on this issue? Like laics above, my code does output Serial.write(data), but can't get to Serial.print("Acknowledgement"). In brief, if I use the app to write something to the Serial and then read with the app, it basically returns what I've printed, even if the Bluno doen't have Serial.write(data) and the data being printed from the microcontroller is different. |
@AllanSCosta this issue is closed so no updates. I'm not sure what the problem is. It's probably that the read is getting more than. 'a' so the if statement never fires. Try matching "a\n" Can you create an example with code and instructions and post to github ornbitbucket? If it's ble-central related open a new issue here. If it's all DFrobot related, open a stackoverflow issue or DFrobot forum post and email me a link. I'll take a look. |
Hi, i am working on one of the examples, redbearlab connecting to bluno board. I am able to use the read method to get serial.write, but unable to read from serial.print or serial.println. May i know which how to read from the string output via serial.print in the sketch?
The text was updated successfully, but these errors were encountered: