TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: bprotzmann on December 26, 2013, 11:47:25 AM

Title: Need help using BLE and Accelerometer together
Post by: bprotzmann on December 26, 2013, 11:47:25 AM
I am building a project that uses the Tiny Circuits Accelerometer to sense movement and the BLE board to transmit the data to an iPhone.  Two issues:
1. can someone help me combine the Arduino code for both to run together?  I can run the BLE code and see the radio broadcasting through the LightBlue app.  When I try to add in the code for the Accelerometer, it breaks.  I am not a coding expert and I am probably just doing something basic, incorrectly.

2. What options do I have to display the data on the iPhone?  Is there a Serial Monitor that will just show that the data is coming across?  I would love to make a dummy app that shows acceleration as a single number readout.
Thanks
Brooks
Title: Re: Need help using BLE and Accelerometer together
Post by: Ariel on January 30, 2015, 07:04:20 PM
Hello Brooks,

I see that you were able to transmit data through the BLE? Can you please guide me about which interface are you using to do so ? Thanks in advance.

Regards,
Title: Re: Need help using BLE and Accelerometer together
Post by: Ariel on January 30, 2015, 07:49:27 PM
Hello Brooks ,
Try using the nRF Master Control app on Google Play to discover your device & talk to it. The BLE BGLib doesn't need any encryption/ pairing to send and receive data. I am using the GATT_HANDLE_C_TX_DATA handle  and the function call to command attribute write.
the following are the parameters to this function.
/* Function */
void ble_cmd_attclient_write_command(
 uint8 connection,
 uint16 atthandle,
 uint8 data_len,
 const uint8* data_data
);
my_data is just an array of size 10. Use the following in void loop()

uint8_t result = ble112.ble_cmd_attributes_write(GATT_HANDLE_C_TX_DATA,0, 10,my_data);
Hope this helps,
Regards,