Nick_Pyner:
If I cut the power to the arduino and the hc05 connected on it, I can pair the device
Really?
Yes, because otherwise the problem is that after flashing the leonardo I cannot get a connection and if I just repair the device I do not have the com-ports recreated. So this is why I need to cut the power of the bt-device.
This is also why I thought of installing a switch, so that I can power on/off bt alone without cutting the power of the imu or the leonardo.
With that background, do you think that this is a good idea?
I think the best procedure is to set it up and debug with the serial monitor and then shut down and change to bluetooth.
Yeah, probably, still I'd like a simpler way when my program will be finished
Yes I'm using the stack on a Dell with XP
After that I get the behaviour described above.
Do you also have to cut the power after flashing something on your arduino?
- I wasn't able to understand why I cannot use the serial monitor. It doesn't work, I can see that, but why????
-->The serial monitor and the bluetooth use the same internal channels.
I don't get that either, sry... Bt is just sendung on a com-port, lets say com7. The serial monitor should just listen to that port and display it, right?
Where is a channel conflcit?
- Is there any way to flash a new program on the leonardo and then get BT to work, without resetting everything again?
I don't think so but, once the programme is loaded, you don't have to worry about this.
Would a simple power switch help so that I could power off the HC05 seperately again?
--> You could do that but I don't see the point.
Answered above
Good idea?
- Is there a way so that my Laptop can connect with the HC05 automatically? Manual connection is also ok, but automatic connection would be much better!
I've read something about an AT-mode to change the settings of the device?
--> Not really. I use a desktop icon to access the Toshiba bluetooth settings window and a another icon for RealTerm which starts with the proper configuration.
Not even with the AT-Mode? I just want to avoid entering the pin over and over again. Something like the HC05 trying to establish the connection with my laptop once it's powered on would be really cool!
You may be able to do this by sending ASCII numbers. I have never included them in a data transmission.
Ah, okay since it is pure ascii my degree symbol and the escape sequence don't work. That makes sense
Still Hterm should be able to interpret a \t as a tab
Unfortunately it seems as it isn't able to do this...
- Often if I enter a long string the leonardo is too fast, so that the buffer hasn't filled and I end up with just a substring. Is there any other way to avoid this instead of a dealy?
-->You could try a higher transmission rate. Otherwise, probably not.
Good idea, thanks! Gonna try that!
The pid is a controller for a closed control loop to maintain a certain output. In my case: stabilize a segway 
Thanks for your code! Is using Serial.write necessary if I collect all the data, concatenate it and then like to print it?