JDY08/HC05 - Updated Serial interface

pull/1/head
Jan Gromeš 2018-07-16 19:13:24 +02:00
rodzic b474daacdd
commit d29be7a252
8 zmienionych plików z 21 dodań i 14 usunięć

Wyświetl plik

@ -21,9 +21,14 @@ void setup() {
}
void loop() {
// read data incoming from Serial port and write them to bluetooth
// HC05 supports all methods of the Serial class
// read data incoming from Serial port and write them to Bluetooth
while(Serial.available() > 0) {
bluetooth.write(Serial.read());
}
// read data incoming from Bluetooth and write them to Serial port
while(bluetooth.available() > 0) {
Serial.write(bluetooth.read());
}
}

Wyświetl plik

@ -19,12 +19,14 @@ void setup() {
}
void loop() {
// read data incoming from Serial port and write them to bluetooth
// JDY08 supports all methods of the Serial class
// read data incoming from Serial port and write them to Bluetooth
while(Serial.available() > 0) {
ble.write(Serial.read());
bluetooth.write(Serial.read());
}
while(ble.available() > 0) {
Serial.write(ble.read());
// read data incoming from Bluetooth and write them to Serial port
while(bluetooth.available() > 0) {
Serial.write(bluetooth.read());
}
}

Wyświetl plik

@ -1,7 +1,7 @@
#include "ISerial.h"
ISerial::ISerial() {
ISerial::ISerial(Module* mod) {
_mod = mod;
}
void ISerial::begin(long speed) {

Wyświetl plik

@ -10,7 +10,7 @@
class ISerial {
public:
ISerial();
ISerial(Module* mod);
void begin(long);
bool listen();

Wyświetl plik

@ -1,7 +1,7 @@
#include "HC05.h"
HC05::HC05(Module* module) {
_mod = module;
HC05::HC05(Module* mod) : ISerial(mod) {
}
void HC05::begin(long speed) {

Wyświetl plik

@ -6,7 +6,7 @@
class HC05: public ISerial {
public:
// constructor
HC05(Module* module);
HC05(Module* mod);
// basic methods
void begin(long speed);

Wyświetl plik

@ -1,7 +1,7 @@
#include "JDY08.h"
JDY08::JDY08(Module* module) {
_mod = module;
JDY08::JDY08(Module* mod) : ISerial(mod) {
}
void JDY08::begin(long speed) {

Wyświetl plik

@ -6,7 +6,7 @@
class JDY08: public ISerial {
public:
// constructor
JDY08(Module* module);
JDY08(Module* mod);
// basic methods
void begin(long speed);