Arduino: how can I stop while() when bluetooth send a data?
Your problem is with this line:

while(mode = 'a') {                 


What you are saying there is not what you think you are saying.  You are confusing = (assignment) with == (comparison).

You are basically saying "While I assign 'a' to the variable 'mode' and 'a' is not 0 ...", which of course will always be true.

Instead you want:

while (mode == 'a') {


or, "While the variable 'mode' contains the letter 'a' ..."

Now you just need to program in some way of changing the value of mode within your while loop.

You can read more on while loops here:


http://hacking.majenko.co.uk/the-while-loop