I want to do Fritzing for this Creating A PCB In Everything series only to. Distinction is arbitrary; all a copper/ground fill does is draw a polygon,.
![]()
HC05An Arduino library for the HC-05 Bluetooth ITead Studio HC-05 SerialPort Module.See the LICENSE file for copyright and license information.The serial port can be configured as any supported Serial port ora SoftwareSerial port.Includes a demonstration program that can be uses to change the namereported by an HC-05 module.Additional information is available as anat. ComponentsHC05A class for controlling and communicating through an ITead StudioHC-05 Serial Port Module. This class inherits from the Stream class. Methods:The Stream class is extended with the following methods. FindBaudDetermine HC-05 communications speed. Make this call in setupinstead of begin.
![]()
Begin is still avaialble and can be usedinplace of findBaud if you know the HC-05 communications speed. SetBaud(unsigned long rate)Specify the HC-05 communications speed.
![]()
The speed is non-volatile socall this only when the rate returned by findBaud is not the oneyou require. SetBaud(unsigned long rate, unsigned long parity, unsigned long stopbits)Use this method when you need something besides the default noparity, one stop bit settings that are the default.CAUTION! The HC-05 supports many serial configurations that are notcompatible with an Arduino. For example, the Arduino software serialport port supports only no parity, one stop bit settings. CmdSend a command to the module. The 'key' (cmdPin) pin is activated toput the module in command mode where 'AT' commands are recognized. CmdMode2Start(int pwrPin)This is an alternate command mode.
This 2nd command mode has theadvantage forcing the HC-05 into a know communications speed: 38400.However, entering this 2nd command mode requires switching the powerto the HC-05. CmdMode2EndExits the alternate command mode, leaving the power to the HC-05 on. Connected (Only if HC05STATEPIN is defined in HC05.h)Returns true when a BT connection has been established. Write print.The write, and print., methods block until there is a BTconnection. Example ProgramsThe default library configuration uses a software serial port. Theexample programs will work with either a hardware or a software serialport. The configuration is changed by modifying the HC05.h file.See the SoftwareSerial.fzz file for the proper default connections.(.fzz files can be read by the free program available from)changeNameThis application is one of the reasons I wrote this library.
Iwanted to be able to change the name reported by the HC-05 because Ihave multiple HC-05 modules that I kept mixing up. With this programyou can set the name of the HC-05 module to reflect somethingphysically identifying (or anything else that helps you tell yourmodules apart).echoEcho characters as they are received.hc05testTests the disconnect command (AT+DISC). This was something I usedduring development and probably is not of general interest.recoverThis example used the 2nd command mode to recover the HC-05 whenits serial port settings are incompatible with the Arduino serialports. Power to HC-05 must be controlled by an Arduino pin.See the Recovery.fzz diagram for suitable connections.findBaudTestTests both setBaud and findBaud by trying every combination ofsupported rates. The output from this example looks best ifDEBUGHC05 is not defined.
(Simply comment out that line in HC05.h). Installation Option 1: Git (Recommended).Follow thisand use git to track your own changes by cloning:$ cd /sketchbook/libraries$ git clone.Start the Arduino IDE and you should find HC05 in thelibraries section.Option 2: Source only.Download a ZIP file. The ZIP button atwill always get thelatest version, but you may prefer one of theversions.Unpack the zip file into your sketchbook library directory( /sketchbook/libraries on Linux).Rename the resulting directory (or create a symlink) to/sketchbook/libraries/HC05.Start the Arduino IDE and you should find HC05 in the librariessection.ConfigurationBy default the library is configured for a software serial port anddebugging output to the hardware serial port (Serial) is turned on. Youwill need to edit the HC05.h file if you want to change those settings.See the SoftwareSerial.fzz file for the proper default connections.The HardwareSerial.fzz shows the hardware port alternative. The filescan be read by the free program available fromThe Bluetooth port is btSerial and must be setup as shown at the topof the Example sketches. If debugging output is enabled in HC05.h (it isby default) then your sketch must include a DEBUGBEGIN(baud) command toinitialize the debug output port and set it's baud rate.
Hardware Serial Port Issues for UNOUsing the hardware serial port on the UNO comes with some caveats:. You will have to disconnect the HC-05 module to upload a sketch. If you use the Arduino Serial Monitor you will see the traffic toand from the HC-05 serial port. If you type in the Serial Monitorit will interfere with the HC-05 traffic.
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |