Power On and OFF Bluetooth HC-05 module inside the code

Hi All,

Is there any code snippet that I can use to power ON and OFF bluetooth HC-05 module inside the code. I found something in HC05.h library. But don't have any idea of how to get this done..... Any advises?

// Entering cmdMode2 uses a pin to turn the HC05 power on and off
// with the cmdPin high. cmdPin must remain high to stay in
// cmdMode2, so use cmdMode2End() to exit.
void cmdMode2Start(int pwrPin);
void cmdMode2End(void);

Charith

Wouldn't it be simpler to have a switching device in the VCC line controlled by a single Arduino pin?

like what? I want to handle inside the code without any manual intervention. Any schematic diagram or advises?

This is common practice but outside my experience. I don’t suppose you would need anything more than a BC377 or similar small transistor. The objective is to reduced the load on the Arduino pins as much as to avoid all that waffle. Arduino’s pins are only good for 20mA, which is plenty good enough for what it is - a microcontroller. Bluetooth’s load can be twice that - which I assume is what this thread is all about.

https://www.sqlskills.com/blogs/paulselec/post/arduino-figuring-out-transistors-and-associated-resistors.aspx