JDY08 - Module added

pull/1/head
Jan Gromeš 2018-07-14 16:12:19 +02:00
rodzic 95760e58e5
commit 50da80561c
4 zmienionych plików z 58 dodań i 0 usunięć

Wyświetl plik

@ -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());
}
}

Wyświetl plik

@ -6,6 +6,7 @@
#include "modules/ESP8266.h"
#include "modules/HC05.h"
#include "modules/JDY08.h"
#include "modules/RF69.h"
#include "modules/SX1231.h"
#include "modules/SX1272.h"

Wyświetl plik

@ -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);
}

Wyświetl plik

@ -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