Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jetdillo

Pages: 1
1
You use the GATT_C_TX_DATA  handle to transmit data.
Here's a brief example of sending random bytes over the TinyDuino BLE shield.
This goes inside the
Code: [Select]
void loop() function of the BGLib_stub_slave() demo code.
I have a rev2 TinyDuino BLE shield FWIW.

You would read this on the master side from the Read/Notify characteristic.

Code: [Select]

         for(int i=0;i < 11;i++) {
             ble_rand_arr[i]= random(255);
             Serial.print("ble_rand_arr:");
             Serial.println(ble_rand_arr[i]);
         }
         
         //copy over to another array just to keep things clean
         uint8_t ble_tx_arr[11];
         memcpy(ble_tx_arr+0,ble_rand_arr,11);
         for (int i=0; i< 11;i++) {
              Serial.print("ble_tx_arr=");
              Serial.println(ble_tx_arr[i]);
         }

          uint8_t result = ble112.ble_cmd_attributes_write(GATT_HANDLE_C_TX_DATA,0, 11,ble_tx_arr);
         //delay a bit to make sure the other side isn't flooded.
         delay(1000);

Pages: 1
SMF spam blocked by CleanTalk