RadioLib/examples/JDY08/JDY08_Basic/JDY08_Basic.ino

33 wiersze
664 B
Arduino
Czysty Zwykły widok Historia

2018-07-14 14:12:19 +00:00
/*
2019-02-08 14:58:29 +00:00
RadioLib JDY08 Example
2018-07-23 10:43:25 +00:00
This example sends data using JDY08 Bluetooth module.
*/
2018-07-14 14:12:19 +00:00
// include the library
2019-02-08 14:58:29 +00:00
#include <RadioLib.h>
2018-07-14 14:12:19 +00:00
// JDY08 module is in slot A on the shield
2019-02-08 14:58:29 +00:00
JDY08 ble = RadioShield.ModuleA;
2018-07-14 14:12:19 +00:00
void setup() {
Serial.begin(9600);
// initialize JDY08
// baudrate: 9600 baud
ble.begin(9600);
}
void loop() {
// JDY08 supports all methods of the Serial class
2018-07-16 17:13:24 +00:00
// read data incoming from Serial port and write them to Bluetooth
2018-07-23 10:43:25 +00:00
while (Serial.available() > 0) {
2018-09-22 15:49:23 +00:00
ble.write(Serial.read());
2018-07-14 14:12:19 +00:00
}
2018-07-23 10:43:25 +00:00
2018-07-16 17:13:24 +00:00
// read data incoming from Bluetooth and write them to Serial port
2018-09-22 16:49:27 +00:00
while (ble.available() > 0) {
2018-09-22 15:49:23 +00:00
Serial.write(ble.read());
2018-07-14 14:12:19 +00:00
}
}