Hi there, i was hired here in the forums by a member to create this sample unfortunately i was never paid what i was promised, regardless i'am posting it in hopes that it helps you get what you need, this was written to work with an HC-06 bluetooth module, study it carefully and use it for what you need.
cheers,
Walter