espnowSimple
1
Loading...
Searching...
No Matches
examples
simplewrite01b
simplewrite01b.ino
Go to the documentation of this file.
1
2
// JDN @ AAU
3
// beer license http://jensd.dk/doc/beerlicense.txt
4
// Apr 2024
5
6
// TX an Array of ints
7
#include <
espnowsimple.h
>
8
9
const
int
arSize
= 10;
10
11
int
txData
[
arSize
],
rxData
[
arSize
];
12
13
int
txCount
= 0,
rxCount
= 0;
14
15
// getting my callbacks
16
void
espSimpleNowCallbackDataSent
(
const
bool
success) {
17
}
18
19
// we do expect one integer
20
void
espSimpleNowCallbackBinRcvd
(
const
uint8_t *data,
int
len) {
21
// chk if (arSize == len) { // yes
22
rxCount
++;
23
for
(
int
i = 0; i <
arSize
; i++) {
24
rxData
[i] =
txData
[i];
25
}
26
}
27
28
void
setup
() {
29
pinMode(5, OUTPUT);
// led pin on cansat NeXt
30
Serial.begin(115200);
31
delay(100);
32
Serial.println(
"test"
);
33
34
espSimpleNowInit
(72);
35
}
36
37
void
txTest
() {
38
//lets send the array
39
espSimpleNowBroadcastData
((
char
*)(
txData
),
arSize
*
sizeof
(
int
));
40
txCount
++;
41
42
digitalWrite(5, !digitalRead(5));
43
delay(500);
44
}
45
46
void
loop
() {
47
//txTest();
48
}
espSimpleNowBroadcastData
uint8_t espSimpleNowBroadcastData(char *data, uint16_t len)
Definition
espnowsimple.cpp:130
espSimpleNowInit
uint8_t espSimpleNowInit(uint8_t macAddrLastByte)
Definition
espnowsimple.cpp:114
espnowsimple.h
espSimpleNowCallbackBinRcvd
void espSimpleNowCallbackBinRcvd(const uint8_t *data, int len)
Definition
simplewrite01b.ino:20
espSimpleNowCallbackDataSent
void espSimpleNowCallbackDataSent(const bool success)
Definition
simplewrite01b.ino:16
txCount
int txCount
Definition
simplewrite01b.ino:13
rxCount
int rxCount
Definition
simplewrite01b.ino:13
setup
void setup()
Definition
simplewrite01b.ino:28
txTest
void txTest()
Definition
simplewrite01b.ino:37
arSize
const int arSize
Definition
simplewrite01b.ino:9
rxData
int rxData[arSize]
Definition
simplewrite01b.ino:11
txData
int txData[arSize]
Definition
simplewrite01b.ino:11
loop
void loop()
Definition
simplewrite01b.ino:46
Generated by
1.14.0