RedBearLab/iOS

9dof razor and BLE mini

Opened this issue · 0 comments

Hi guys,

I'm trying to transmit data from the 9dof Razor IMU module (from Sparkfun) via the BLE mini (Red Bear labs) to the BLEChat_Central_OSX app and it doesn't work :/

The codes I use are:

I tried to transmit via BLE only one value with following code:

     Serial.print(int(smoothedAX));

     Serial.println();

But when running the BLEChat on Xcode I receive only "i" and "Y" values:

2014-07-16 18:27:01.389 BLEChat Central[395:303] scanForPeripheralsWithServices

2014-07-16 18:27:02.108 BLEChat Central[395:303] didDiscoverPeripheral

2014-07-16 18:27:02.426 BLEChat Central[395:303] Duplicate UUID found updating...

2014-07-16 18:27:03.389 BLEChat Central[395:303] Stopped Scanning

2014-07-16 18:27:03.389 BLEChat Central[395:303] Known peripherals : 1

2014-07-16 18:27:03.389 BLEChat Central[395:303] List of currently known peripherals :

2014-07-16 18:27:03.390 BLEChat Central[395:303] 0  |  308B4C0E-F756-434C-84D4-B474B1C12AD6

2014-07-16 18:27:03.390 BLEChat Central[395:303]
------------------------------------

2014-07-16 18:27:03.390 BLEChat Central[395:303] Peripheral Info :

2014-07-16 18:27:03.390 BLEChat Central[395:303] UUID : 308B4C0E-F756-434C-84D4-B474B1C12AD6

2014-07-16 18:27:03.390 BLEChat Central[395:303] Name : Biscuit

2014-07-16 18:27:03.391 BLEChat Central[395:303]
-------------------------------------

2014-07-16 18:27:03.391 BLEChat Central[395:303] Connecting to peripheral with UUID : 308B4C0E-F756-434C-84D4-B474B1C12AD6

2014-07-16 18:27:03.567 BLEChat Central[395:303] Connected to 308B4C0E-F756-434C-84D4-B474B1C12AD6 successful

2014-07-16 18:27:03.582 BLEChat Central[395:303] ->Connected

2014-07-16 18:27:03.747 BLEChat Central[395:303] Length: 2

2014-07-16 18:27:03.747 BLEChat Central[395:303] y

2014-07-16 18:27:03.749 BLEChat Central[395:303] Length: 2

2014-07-16 18:27:03.749 BLEChat Central[395:303] y

2014-07-16 18:27:03.750 BLEChat Central[395:303] Length: 2

2014-07-16 18:27:03.750 BLEChat Central[395:303] i

2014-07-16 18:27:03.814 BLEChat Central[395:303] Length: 2

2014-07-16 18:27:03.814 BLEChat Central[395:303] i

2014-07-16 18:27:03.816 BLEChat Central[395:303] Length: 2

2014-07-16 18:27:03.816 BLEChat Central[395:303] i

2014-07-16 18:27:03.817 BLEChat Central[395:303] Length: 2

2014-07-16 18:27:03.817 BLEChat Central[395:303] i

2014-07-16 18:27:03.818 BLEChat Central[395:303] Length: 2

2014-07-16 18:27:03.818 BLEChat Central[395:303] i

I also tried to transmit the data with an adaption of the arduino code:

     // uint16_t value = smoothedAX;

     uint16_t value = 123; // fake reading

     BLEMini_write(0x0B);

     BLEMini_write(value >> 8);

     BLEMini_write(value);

But then I receive an error message instantly:

2014-07-16 18:28:04.930 BLEChat Central[425:303] scanForPeripheralsWithServices

2014-07-16 18:28:04.964 BLEChat Central[425:303] didDiscoverPeripheral

2014-07-16 18:28:04.964 BLEChat Central[425:303] Duplicate UUID found updating...

2014-07-16 18:28:06.932 BLEChat Central[425:303] Stopped Scanning

2014-07-16 18:28:06.932 BLEChat Central[425:303] Known peripherals : 1

2014-07-16 18:28:06.932 BLEChat Central[425:303] List of currently known peripherals :

2014-07-16 18:28:06.932 BLEChat Central[425:303] 0  |  308B4C0E-F756-434C-84D4-B474B1C12AD6

2014-07-16 18:28:06.932 BLEChat Central[425:303] ------------------------------------

2014-07-16 18:28:06.933 BLEChat Central[425:303] Peripheral Info :

2014-07-16 18:28:06.933 BLEChat Central[425:303] UUID : 308B4C0E-F756-434C-84D4-B474B1C12AD6

2014-07-16 18:28:06.933 BLEChat Central[425:303] Name : Biscuit

2014-07-16 18:28:06.933 BLEChat Central[425:303] -------------------------------------

2014-07-16 18:28:06.933 BLEChat Central[425:303] Connecting to peripheral with UUID : 308B4C0E-F756-434C-84D4-B474B1C12AD6

2014-07-16 18:28:06.975 BLEChat Central[425:303] Connected to 308B4C0E-F756-434C-84D4-B474B1C12AD6 successful

2014-07-16 18:28:06.991 BLEChat Central[425:303] ->Connected

2014-07-16 18:28:07.131 BLEChat Central[425:303] Length: 2

2014-07-16 18:28:07.132 BLEChat Central[425:303] (null)

2014-07-16 18:28:07.133 BLEChat Central[425:303] An uncaught exception was raised

2014-07-16 18:28:07.134 BLEChat Central[425:303] -[__NSCFString appendString:]: nil argument

2014-07-16 18:28:07.134 BLEChat Central[425:303] (

0   CoreFoundation                      0x00007fff82e5725c __exceptionPreprocess + 172

1   libobjc.A.dylib                     0x00007fff88243e75 objc_exception_throw + 43

2   CoreFoundation                      0x00007fff82e5710c +[NSException raise:format:] + 204

3   CoreFoundation                      0x00007fff82e26def mutateError + 159

4   BLEChat Central                     0x00000001000054d1 -[RBLAppDelegate bleDidReceiveData:length:] + 257

5   BLEChat Central                     0x0000000100004cb2 -[BLE peripheral:didUpdateValueForCharacteristic:error:] + 770

6   CoreBluetooth                       0x00007fff884b4089 -[CBCentralManager xpcConnection:didReceiveMsg:args:] + 101

7   CoreBluetooth                       0x00007fff884bd88b __34-[CBXpcConnection handleMsg:args:]_block_invoke + 81

8   libdispatch.dylib                   0x00007fff884c81bb _dispatch_call_block_and_release + 12

9   libdispatch.dylib                   0x00007fff884c528d _dispatch_client_callout + 8

10  libdispatch.dylib                   0x00007fff884ccef0 _dispatch_main_queue_callback_4CF + 333

11  CoreFoundation                      0x00007fff82dbe4f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9

12  CoreFoundation                      0x00007fff82d79714 __CFRunLoopRun + 1636

13  CoreFoundation                      0x00007fff82d78e75 CFRunLoopRunSpecific + 309

14  HIToolbox                           0x00007fff877cea0d RunCurrentEventLoopInMode + 226

15  HIToolbox                           0x00007fff877ce7b7 ReceiveNextEventCommon + 479

16  HIToolbox                           0x00007fff877ce5bc _BlockUntilNextEventMatchingListInModeWithFilter + 65

17  AppKit                              0x00007fff833f624e _DPSNextEvent + 1434

18  AppKit                              0x00007fff833f589b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122

19  AppKit                              0x00007fff833e999c -[NSApplication run] + 553

20  AppKit                              0x00007fff833d4783 NSApplicationMain + 940

21  BLEChat Central                     0x0000000100005122 main + 34

22  libdyld.dylib                       0x00007fff87eea5fd start + 1

)

2014-07-16 18:28:07.135 BLEChat Central[425:303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString appendString:]: nil argument'

*** First throw call stack:

(

0   CoreFoundation                      0x00007fff82e5725c __exceptionPreprocess + 172

1   libobjc.A.dylib                     0x00007fff88243e75 objc_exception_throw + 43

2   CoreFoundation                      0x00007fff82e5710c +[NSException raise:format:] + 204

3   CoreFoundation                      0x00007fff82e26def mutateError + 159

4   BLEChat Central                     0x00000001000054d1 -[RBLAppDelegate bleDidReceiveData:length:] + 257

5   BLEChat Central                     0x0000000100004cb2 -[BLE peripheral:didUpdateValueForCharacteristic:error:] + 770

6   CoreBluetooth                       0x00007fff884b4089 -[CBCentralManager xpcConnection:didReceiveMsg:args:] + 101

7   CoreBluetooth                       0x00007fff884bd88b __34-[CBXpcConnection handleMsg:args:]_block_invoke + 81

8   libdispatch.dylib                   0x00007fff884c81bb _dispatch_call_block_and_release + 12

9   libdispatch.dylib                   0x00007fff884c528d _dispatch_client_callout + 8

10  libdispatch.dylib                   0x00007fff884ccef0 _dispatch_main_queue_callback_4CF + 333

11  CoreFoundation                      0x00007fff82dbe4f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9

12  CoreFoundation                      0x00007fff82d79714 __CFRunLoopRun + 1636

13  CoreFoundation                      0x00007fff82d78e75 CFRunLoopRunSpecific + 309

14  HIToolbox                           0x00007fff877cea0d RunCurrentEventLoopInMode + 226

15  HIToolbox                           0x00007fff877ce7b7 ReceiveNextEventCommon + 479

16  HIToolbox                           0x00007fff877ce5bc _BlockUntilNextEventMatchingListInModeWithFilter + 65

17  AppKit                              0x00007fff833f624e _DPSNextEvent + 1434

18  AppKit                              0x00007fff833f589b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122

19  AppKit                              0x00007fff833e999c -[NSApplication run] + 553

20  AppKit                              0x00007fff833d4783 NSApplicationMain + 940

21  BLEChat Central                     0x0000000100005122 main + 34

22  libdyld.dylib                       0x00007fff87eea5fd start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

I tried to look for a solution for three days but I haven't been able to solve the problem. It would be really nice if you could help me :)

Thanks a lot in advance and cheers!