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

Connecting to RFdunio #2

Open
laurenzrau91 opened this issue Jan 15, 2016 · 2 comments
Open

Connecting to RFdunio #2

laurenzrau91 opened this issue Jan 15, 2016 · 2 comments
Assignees

Comments

@laurenzrau91
Copy link

Hi again,
I´m still having problems to get a working communication from the iphone app to a RFduino.
The code is quite the same as the example code:

Just checking if the touch event is executed:

void ofApp::touchDown(ofTouchEventArgs & touch){
    unsigned char data[3];
    data[0] = '1';
    data[1] = '2';
    data[2] = '3';
    ofxBLESendData(BLEDeviceImpl, &data[0], tx, 3);
     cout << " didSendData " << endl;
}

And connecting to my particular device:

void ofApp::didDiscoverBLEDevice(BLEDevice *device)
{
    cout << " didDiscoverBLEDevice " << endl;
    if(device.name != nil)
    {
        std::string deviceName([device.name UTF8String]);
            cout << deviceName << endl;
      //  cout << device.advertisementRSSI <<endl;

        if(deviceName == "LaurenzRFduino") {
            ofxBLEConnectDevice(device);

        }
    }
}

The connection is working and the touch is executed but no data are recieved on the Arduino end.

2016-01-15 15:09:21.911 HelloBT[813:222123] Creating OpenGL ES1 Renderer
2016-01-15 15:09:21.951 HelloBT[813:222123] init
2016-01-15 15:09:21.970 HelloBT[813:222123] central manager state = 5
2016-01-15 15:09:21.970 HelloBT[813:222123] CoreBluetooth BLE hardware is powered on and ready
2016-01-15 15:09:21.970 HelloBT[813:222123] startScan
2016-01-15 15:09:22.010 HelloBT[813:222123] BLEDevice init
didDiscoverBLEDevice
LaurenzRFduino
2016-01-15 15:09:22.010 HelloBT[813:222123] connect ble
2016-01-15 15:09:22.215 HelloBT[813:222123] didConnectPeripheral
2016-01-15 15:09:22.216 HelloBT[813:222123] BLEDevice connected
didConnectBLEDevice
2016-01-15 15:09:22.492 HelloBT[813:222123] didDiscoverServices
2016-01-15 15:09:22.616 HelloBT[813:222123] didDiscoverCharacteristicsForService
didSendData
didSendData
didSendData
didSendData

Thats the other side:

#include <RFduinoBLE.h>


int testData = 1;
bool didConnect=false;

void setup() {
  Serial.begin(9600);
  RFduinoBLE.deviceName = "LaurenzRFduino";
  RFduinoBLE.advertisementData = "data";
  RFduinoBLE.begin();
 // RFduinoBLE.txPowerLevel = +4;


}

void loop() {
 //RFduinoBLE.sendInt(testData);
}

void RFduinoBLE_onAdvertisement(bool start) {
}

void RFduinoBLE_onConnect(){
Serial.println("Did connect");
 RFduinoBLE.sendInt(testData);
didConnect= true;
}

void RFduinoBLE_onRSSI(int rssi){ 
 Serial.println(rssi); // print rssi value via serial }
}

void RFduinoBLE_onDisconnect(){
Serial.println("Did disconnect");
didConnect= false;
}

void RFduinoBLE_onReceive(char *data, int len)
{
  // display the first recieved byte
  //Serial.println(data[0]);
  //Serial.println(len);
    Serial.println("hello");
    RFduinoBLE.sendInt(testData);
}

Same thing here: The connection works and I do get an RSSI value but no data is recieved nor can I send anything in the other direction.

@joshuajnoble
Copy link
Owner

This looks like it should all be working. I'll set something up here and see what I can figure out.

@joshuajnoble joshuajnoble self-assigned this Jan 19, 2016
@joshuajnoble
Copy link
Owner

So sorry to drop the ball on this! Could you put a breakpoint at line 257 of BLEDelegate.mm in the method - (void) send:( unsigned char *) data len:(int)length and let me know what happens in there? I'm wondering if there's problem with the characteristic definitions somehow?

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