forked from baselsw/BPLib
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating Readme, adding library.properties and adding source code to …
…a src folder
- Loading branch information
1 parent
7e4f9f7
commit 481d6ad
Showing
4 changed files
with
60 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,60 @@ | ||
BPLib - Bluetooth SPP/HID Library | ||
===== | ||
|
||
This library simplifies the communication protocol between the RN-42 (HID enabled) device and the atmega32u4. | ||
Some functions won't work on for example (Arduino(R) Leonardo) because there is some hardware mods between the module | ||
and the atmega32u4. One of these functions/statements is the "connected()" statement in the library. | ||
This library simplifies using the RN-42 Bluetooth Module ([or the $3 HC-05/6 flashed with RN-42 firmware](https://youtu.be/y8PcNbAA6AQ)). | ||
|
||
The library is written with arduino statements (like Serial.begin(), etc) inorder to make the code very | ||
simple/understandable/editable to a Arduino IDE newcomer. | ||
The main advantage of the RN-42 module is it allows you to emulate HID devices, which allows your Arduino project to connect to your devices as a Bluetooth keyboard, mouse or gamepad. | ||
|
||
The library isn't complete, todo list: | ||
This library is forked from this one [here](https://github.com/baselsw/BPLib), the main differences between this one and the original is that hardcoded references to a serial interface have been removed so it can be used with basically any Arduino device. | ||
|
||
- Add, authorization mode: Toggle between an Open/Pin Locked connection. | ||
- Add, more keyboard scan codes | ||
- Add, software connection check (to support Arduino Uno/Leonardo/Mega) | ||
## Usage | ||
|
||
Working with following boards: | ||
- BlueNar One | ||
- Arduino(R) Leonardo (One function doesn't work, everything else AOK) | ||
Basic usage of the library is as shown, this sketch when connected to your device will send the key commands "H" and "i" every 5 seconds. | ||
|
||
The library will work with the following BT protocols: | ||
- SPP (Bluetooth Serial) | ||
- HID (Bluetooth Human Interface Device) | ||
- Keyboard | ||
- Mouse | ||
- Combo (Keyboard + Mouse) | ||
- Joystick | ||
- Gamepad | ||
``` | ||
#include <BPLib.h> | ||
BPLib *BPMod; | ||
For example code, see the examples directory | ||
void setup(){ | ||
Serial.begin(115200); // 115200 is the default baud of the RN-42 | ||
BPMod = new BPLib(Serial); | ||
BPMod->begin(BP_MODE_HID,BP_HID_KEYBOARD); //Begin HID Mode with HID KEYBOARD AS TYPE | ||
} | ||
void loop(){ | ||
delay(5000); | ||
BPMod->sendString("Hi"); | ||
} | ||
``` | ||
|
||
The library also supports connecting using software serial interfaces. | ||
|
||
``` | ||
#include <SoftwareSerial.h> | ||
SoftwareSerial swSer(1, 2, false, 128); | ||
.... | ||
void setup(){ | ||
swSer.begin(115200); | ||
BPMod = new BPLib(swSer); | ||
BPMod->begin(BP_MODE_HID,BP_HID_KEYBOARD); | ||
} | ||
... | ||
``` | ||
|
||
It is also worth noting that the **BPMod->begin** method is a once off configuration, if you do it for your module once it does not need to be run again, even after reboots, so it does not need to be part of your final sketch. | ||
|
||
## Examples | ||
|
||
- [Keyboard - Using software serial](https://github.com/witnessmenow/BPLib/blob/master/examples/HID_KEYBOARD/HID_KEYBOARD.ino) | ||
- [Mouse](https://github.com/witnessmenow/BPLib/blob/master/examples/HID_MOUSE/HID_MOUSE.ino) | ||
- [Mouse Wheel](https://github.com/witnessmenow/BPLib/blob/master/examples/HID_MOUSE_WHEEL/HID_MOUSE_WHEEL.ino) | ||
- [Basic serial connection](https://github.com/witnessmenow/BPLib/blob/master/examples/SPP_SEND_REC_MSG/SPP_SEND_REC_MSG.ino) | ||
|
||
|
||
## Details | ||
|
||
Check out the [header file of the library](https://github.com/witnessmenow/BPLib/blob/master/src/BPLib.h) for a full list of functions and parameters available. If you have suggests on how to present this better please feel free to submit a PR! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name=BPLib | ||
version=1.0.0 | ||
author=Brian Lough | ||
maintainer=Brian Lough <brian.d.lough@gmail.com> | ||
sentence=This library simplifies using the RN-42 Bluetooth Module | ||
paragraph=This library simplifies using the RN-42 Bluetooth Module, the main advantage of the RN-42 module is it allows you to emulate HID devices, which allows your Arduino project to connect to your devices as a Bluetooth keyboard, mouse or gamepad. | ||
category=Communication | ||
url=https://github.com/witnessmenow/BPLib | ||
architectures=* |
File renamed without changes.
File renamed without changes.