JDY08 - Module added
This commit is contained in:
parent
95760e58e5
commit
50da80561c
4 changed files with 58 additions and 0 deletions
30
examples/JDY08/JDY08.ino
Normal file
30
examples/JDY08/JDY08.ino
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* KiteLib JDY08 Example
|
||||||
|
*
|
||||||
|
* This example sends data using JDY08 Bluetooth module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <KiteLib.h>
|
||||||
|
|
||||||
|
// JDY08 module is in slot A on the shield
|
||||||
|
JDY08 ble = Kite.ModuleA;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize JDY08
|
||||||
|
// baudrate: 9600 baud
|
||||||
|
ble.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// read data incoming from Serial port and write them to bluetooth
|
||||||
|
// JDY08 supports all methods of the Serial class
|
||||||
|
while(Serial.available() > 0) {
|
||||||
|
ble.write(Serial.read());
|
||||||
|
}
|
||||||
|
while(ble.available() > 0) {
|
||||||
|
Serial.write(ble.read());
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "modules/ESP8266.h"
|
#include "modules/ESP8266.h"
|
||||||
#include "modules/HC05.h"
|
#include "modules/HC05.h"
|
||||||
|
#include "modules/JDY08.h"
|
||||||
#include "modules/RF69.h"
|
#include "modules/RF69.h"
|
||||||
#include "modules/SX1231.h"
|
#include "modules/SX1231.h"
|
||||||
#include "modules/SX1272.h"
|
#include "modules/SX1272.h"
|
||||||
|
|
12
src/modules/JDY08.cpp
Normal file
12
src/modules/JDY08.cpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#include "JDY08.h"
|
||||||
|
|
||||||
|
JDY08::JDY08(Module* module) {
|
||||||
|
_mod = module;
|
||||||
|
}
|
||||||
|
|
||||||
|
void JDY08::begin(long speed) {
|
||||||
|
// set module properties
|
||||||
|
_mod->AtLineFeed = "";
|
||||||
|
_mod->baudrate = speed;
|
||||||
|
_mod->init(USE_UART, INT_NONE);
|
||||||
|
}
|
15
src/modules/JDY08.h
Normal file
15
src/modules/JDY08.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef _KITELIB_JDY08_H
|
||||||
|
#define _KITELIB_JDY08_H
|
||||||
|
|
||||||
|
#include "ISerial.h"
|
||||||
|
|
||||||
|
class JDY08: public ISerial {
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
JDY08(Module* module);
|
||||||
|
|
||||||
|
// basic methods
|
||||||
|
void begin(long speed);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Reference in a new issue