32 lines
664 B
C++
32 lines
664 B
C++
/*
|
|
RadioLib JDY08 Example
|
|
|
|
This example sends data using JDY08 Bluetooth module.
|
|
*/
|
|
|
|
// include the library
|
|
#include <RadioLib.h>
|
|
|
|
// JDY08 module is in slot A on the shield
|
|
JDY08 ble = RadioShield.ModuleA;
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
|
|
// initialize JDY08
|
|
// baudrate: 9600 baud
|
|
ble.begin(9600);
|
|
}
|
|
|
|
void loop() {
|
|
// 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());
|
|
}
|
|
|
|
// read data incoming from Bluetooth and write them to Serial port
|
|
while (ble.available() > 0) {
|
|
Serial.write(ble.read());
|
|
}
|
|
}
|