Commit 3a4a29b4 by satsob

RF24

parent 4201e184
Showing with 3 additions and 5 deletions
...@@ -7,7 +7,7 @@ RF24 radio(9,10); // Create RF24 object to work with the RF24 library. ...@@ -7,7 +7,7 @@ RF24 radio(9,10); // Create RF24 object to work with the RF24 library.
BTLE btle(&radio); // Create BTLE object to work with the BTLE library. BTLE btle(&radio); // Create BTLE object to work with the BTLE library.
// Replace! "CustomName" to the name of your device. Password - maximum length (14)! characters // Replace! "CustomName" to the name of your device. Password - maximum length (14)! characters
#define PASSWORD "CustomName" #define PASSWORD "Galaxy A70"
void setup() { void setup() {
/* Start the Serial and btle. */ /* Start the Serial and btle. */
...@@ -22,7 +22,6 @@ void loop() { ...@@ -22,7 +22,6 @@ void loop() {
/* Start listening. If data is received it is stored in the "buffer". /* Start listening. If data is received it is stored in the "buffer".
Then the received data is decoded and checked (CRC). */ Then the received data is decoded and checked (CRC). */
Serial.print("Listening... ");
if (btle.listen()) { if (btle.listen()) {
Serial.print("Got payload: "); // If data is received, print "Got payload: " Serial.print("Got payload: "); // If data is received, print "Got payload: "
...@@ -30,7 +29,7 @@ void loop() { ...@@ -30,7 +29,7 @@ void loop() {
for (uint8_t i = 2; i < (btle.buffer.pl_size)-6; i++) { for (uint8_t i = 2; i < (btle.buffer.pl_size)-6; i++) {
str += (char (btle.buffer.payload[i])); str += (char (btle.buffer.payload[i]));
// Serial.print(btle.buffer.payload[i],HEX); Serial.print(" "); // To receive data in HEX format // Serial.print(btle.buffer.payload[i],HEX); Serial.print(" "); // To receive data in HEX format
Serial.print(char (btle.buffer.payload[i])); Serial.print(" "); // To receive data in char format // Serial.print(char (btle.buffer.payload[i])); Serial.print(" "); // To receive data in char format
} }
// (Spam protection) only if string starts with "CustomName" // (Spam protection) only if string starts with "CustomName"
...@@ -45,6 +44,5 @@ void loop() { ...@@ -45,6 +44,5 @@ void loop() {
} }
} }
// Serial.println("done."); btle.hopChannel();
// btle.hopChannel();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment