espnowSimple 1
Loading...
Searching...
No Matches
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
9const int arSize = 10;
10
12
13int txCount = 0, rxCount = 0;
14
15// getting my callbacks
16void espSimpleNowCallbackDataSent(const bool success) {
17}
18
19// we do expect one integer
20void 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
28void setup() {
29 pinMode(5, OUTPUT); // led pin on cansat NeXt
30 Serial.begin(115200);
31 delay(100);
32 Serial.println("test");
33
35}
36
37void 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
46void loop() {
47 //txTest();
48}
uint8_t espSimpleNowBroadcastData(char *data, uint16_t len)
uint8_t espSimpleNowInit(uint8_t macAddrLastByte)
void espSimpleNowCallbackBinRcvd(const uint8_t *data, int len)
void espSimpleNowCallbackDataSent(const bool success)
int txCount
int rxCount
void setup()
void txTest()
const int arSize
int rxData[arSize]
int txData[arSize]
void loop()