Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
satsob
/
Robotite_ylesannete_projekt
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3a4a29b4
authored
Oct 04, 2020
by
satsob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RF24
parent
4201e184
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
nRF_BTLE_ReceiveData/nRF_BTLE_ReceiveData.ino
nRF_BTLE_ReceiveData/nRF_BTLE_ReceiveData.ino
View file @
3a4a29b4
...
@@ -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();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment