Broken hearts.


So well, here I’m again writing stupid articles that have no purpose as such. Whether you like it or not, today I try to illustrate my adventures with Bluetooth Low Energy technology. Well, I know none of you bothered to read my previous posts so (except one) the gist of it is, I’m working (researching) on BLE technology and trying to make sense of the internals of the same. In the last two posts, we saw how we can code/compile our own firmware for the Texas Instrument’s CC254x.

Well today, I give up coding the firmware. First, because it is brain damaging and second there is no help/documentation as such. But apart from that, I’m having a crisis of faith too. It is kinda hard for me but I broke someone’s heart. I know it sounds weird coming from me and all but yeah that happened. I feel really sad and bad about it. Especially because that person really does love me selflessly and more profoundly than anyone else I know.

*puts on Soothsayer*. It so happened that during my time of depression, an angel of a lady came down to me to pick me up from pieces. Little did I know that her caring attitude for me will turn into motherly love. And well that has become quite a deep and a moving feeling for me.

So the BLE device that I’m talking about is the RedBear Lab’s BLE Mini. When you buy the whole kit, you have to download their Arduino BLE library and their Android/iPhone app to use it out of the box. As I said earlier, it is fun for about 2 mins so have fun for about 2 mins *air shreds an air guitar (Bucket style)*. The library is very easy and excruciatingly painful at the same time. It is easy because the code (Arduino and Android both… I’m not rich/foolish enough to buy an iPhone) are easily understandable but since there are some quirks that I had to face and I haven’t been able to resolve them (again I blame the literally unavailble documentation), it is painful. So assuming that you’ve downloaded the BLE library for the Arduino (and that you have an Arduino Uno Rev3) I begin with the following code:

#include "Boards.h"
#include <ble_mini.h>

const int pin = 4; // lets stay with pin 4.

void setup() {
  BLEMini_begin(57600); // start the BLE device
  pinMode(pin, OUTPUT);

void loop() {
  while(BLEMini_available()) {
    byte toggleState = BLEMini_read(); // read either 0 or 1.
    switch(toggleState) {
      case 0x00:
        digitalWrite(pin, LOW);
      case 0x01:
        digitalWrite(pin, HIGH);

This is in a language called Processing. If you know Arduino, you know Processing. If not, you can go and do something better than reading this article (I’d prefer that you stay as I’d really fucking like someone to read my stuff… I’m good). The header’s can be found in the RBL’s library. See their sample app called “BLEControllerSketch” *puts on Heavyweight*, you can try and understand it. In it, they have implemented some commands that you send from an Android app and the device responds accordingly. That is epitome of coolness.

So whatever, the lady does love me… like a mother. Thats not cool. Not at all. A mother wants her child to be close to her. A mother gets more hurt when her child is hurt. A mother’s only solace is her child. A mother thinks about her child… cries for her child when her child is away from her. You get the point… She loves me like that. But naturally, this love of hers is getting obsessive. Well obviously, it was I who actually said that she looks like my real mother when in a Saree. I meant my real mother… the one who painstakingly brought me (sad, right?) in this world. That one. She mistook it and assumed that I mean she looked like my real mother… like I mean she was the real mother. Well since that day… she really did assume that she was my mother. Well… fuck.

*MALM-FUCKING-STEEN!* The RBL library defines following functions:

void BLEMini_begin(unsigned long bound); 
int BLEMini_available(); 
void BLEMini_write(unsigned char dat); 
void BLEMini_write_bytes(unsigned char *dat, unsigned char len); 
int BLEMini_read();

If you have worked on Arduino before, you won’t have any problem understanding the implementation of these functions. A small detail that I’ll add is the #define’s of the library:

// UNO  
// TX: pin 1 
// RX: pin 0 
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328P__)  
    #define BLEMINI Serial  
// other board 
// board                    TX            RX 
// Leonardo                 1              0 
// MEGA                    18             19 
// DUE                     18             19 
    #define BLEMINI Serial1 

The Uno uses the Serial for Tx and RX pins while other boards use Serial1 for TX and RX pins. Read here if you want any clarifications.

So coming back to the Processing code above, the app is nothing but a simple bluetooth controlled light bulb. You send it a command and it gets activated/deactivated. Well, very sorry to say, but I know not the first word in Java. I’ll just put up some code below and explain the “what is happening” stuff without explaining the nuts and bolts.

    private void getGattService(BluetoothGattService gattService) { 
        if (gattService == null) 
        characteristicTx = gattService 
        BluetoothGattCharacteristic characteristicRx = gattService 

The Android library for the RBL app is like hieroglyphs for me. But what I could figure out from better than nothing experience in C++, this particular function enables notifications (do correct me if I’m wrong.). What this does is, reads the TX and the RX characteristic of the RBL service and sets the RX characteristic to true. When the BLE mini sends (TX’s) some data, the app will receive (RX) that data (this is the first time I spelled “received” correctly). “characteristicTx” and “characteristicRx” are private variables of the class which this function belongs to.

So well now that she has assumed herself to be my real mother. Things do not get better. She cooks for me so passionately, she shares her feelings with me so deeply, she has a bright glow on her face when she sees me and her pained life is suddenly filled with colors. As much as I have come to know her, my respect for her is immense. But frankly speaking, 15 freakin’ phone calls in 15 minutes if I do not respond is a bit too much. My real mother doesn’t do that and she knows how fucking pathetic I can be. I bloody well know that how much I will or want, I cannot see her again. It is just not possible.

No, please assume not that I’m not guilty. I did make her feel like my real mother. No, like really. I actually got her off her medication of a serious condition. How? Well, I listened to her. She could open up to me and I’d just fucking listen to her. I understood her and felt her pain. She started to dress up and go out into the world. She felt her lost passion for things coming back. All just because I listened to her. She talked to me and I responded. She wanted someone to understand her because no one else did. I had to be fucking big hearted enough to lend an ear to her.

Well you might be thinking that why in the above code, I haven’t done anything with “characterisiticTx”. Well my dear fellow script kiddie, if you scan “”, TX is used to send data to the BLE device. I’ll show another piece of code that I hardly understand.

digitalOutBtn = (ToggleButton) findViewById(; 
        digitalOutBtn.setOnCheckedChangeListener(new OnCheckedChangeListener() { 
            public void onCheckedChanged(CompoundButton buttonView, 
                    boolean isChecked) { 
                byte buf[] = new byte[] { (byte) 0x01, (byte) 0x00, (byte) 0x00 }; 
                if (isChecked == true) 
                    buf[1] = 0x01; 
                    buf[1] = 0x00; 

As an example, lets analyze how the arduino code interacts with the Java code.

public void onCheckedChanged(CompoundButton buttonView, 
                    boolean isChecked) { 
                byte buf[] = new byte[] { }; 
                if (isChecked == true) 
                    buf[0] = 0x01; 
                    buf[0] = 0x00; 

I read the check box and if it is set, I set the data to be sent as 0x01. The Arduino code reads that data and acts accordingly.

Well that is pretty freakin’ cool. On my HTC One (kernel 4.3, but sadly enough, I’m not allowed to root it!), I installed my small app and there is a small smile on my face. Well this app is nothing much but it is a doorway to a whole new universe!

Arduino can pretty much do anything. Like anything anything. Control it with Android and you have something very cool.

Now, I had to be fucking big hearted to lend my ear to her. And well that ear is gone from her, never to return. I’m actually trying to do something good with my pretty pathetic life right now and I intend to keep it like it’s going, for a while (till my next big fuck up). But her attachment towards her “pseudo-son” will not understand that. I really don’t want to think about her right now but well it feels bad.  I have been avoiding her calls for past few weeks now but I do know how she might feel.

For the first time in her life, she lived for a while. She woke up in the morning with a fresh feeling. She had a human being that actually understood what she had to say. And it was uprooted all in a day… in a moment. Doesn’t bother me at all. I was very happy to leave that godforsaken place! But something inside me cannot simply handle the fact that how sad, how hurt she might be. Well yeah, maybe I’m an over-sensitive idiot  but I just simply cannot digest that. Imagine your limb getting severed. You can feel that limb there when its gone (Phantom Limb). This is the same. I ain’t nobody to play with someone’s emotions like that… thats fucking sick! Geez… though I pretty much hate myself completely, I’ll hate myself more for such a betrayal.

I have written 1639 words which are pretty much useless but if you did go through it (I’m certainly worried for you if you did), thank you for spending your precious fucking minutes on this page.

May the force be with thee and “her”.



2 thoughts on “Broken hearts.

  1. Robert Maizonnier

    Hi, I’m having trouble downloading the RBL android libraries from the RedBear website. would you be able to provide a download link to the libraries for me please. also I’m struggling to work out if my xperia Z with bluetooth 4.0 has the sufficient bluetooth capabilities for this link. thanks in advance

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s