kopia lustrzana https://github.com/jgromes/RadioLib
JDY08/HC05 - Updated Serial interface
rodzic
b474daacdd
commit
d29be7a252
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "ISerial.h"
|
||||
|
||||
ISerial::ISerial() {
|
||||
|
||||
ISerial::ISerial(Module* mod) {
|
||||
_mod = mod;
|
||||
}
|
||||
|
||||
void ISerial::begin(long speed) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
class ISerial {
|
||||
public:
|
||||
ISerial();
|
||||
ISerial(Module* mod);
|
||||
|
||||
void begin(long);
|
||||
bool listen();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "HC05.h"
|
||||
|
||||
HC05::HC05(Module* module) {
|
||||
_mod = module;
|
||||
HC05::HC05(Module* mod) : ISerial(mod) {
|
||||
|
||||
}
|
||||
|
||||
void HC05::begin(long speed) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class HC05: public ISerial {
|
||||
public:
|
||||
// constructor
|
||||
HC05(Module* module);
|
||||
HC05(Module* mod);
|
||||
|
||||
// basic methods
|
||||
void begin(long speed);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "JDY08.h"
|
||||
|
||||
JDY08::JDY08(Module* module) {
|
||||
_mod = module;
|
||||
JDY08::JDY08(Module* mod) : ISerial(mod) {
|
||||
|
||||
}
|
||||
|
||||
void JDY08::begin(long speed) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class JDY08: public ISerial {
|
||||
public:
|
||||
// constructor
|
||||
JDY08(Module* module);
|
||||
JDY08(Module* mod);
|
||||
|
||||
// basic methods
|
||||
void begin(long speed);
|
||||
|
|
Ładowanie…
Reference in New Issue