espnowSimple 1
Loading...
Searching...
No Matches
simplewrite01.ino
Go to the documentation of this file.
1// JDN @ AAU
2// beer license http://jensd.dk/doc/beerlicense.txt
3// Apr 2024
4
5#include <espnowsimple.h>
6
7// getting my callbacks
8void espSimpleNowCallbackDataSent(const bool success) {
9 uint8_t scs;
10 scs = success;
11 Serial.print("tx(0 == ok) ");
12 Serial.println(scs);
13}
14
15// Yo shall provide a function with this name and parameters
16// so the network can deliver data to you this way
17// Here we do expect an int
18void espSimpleNowCallbackBinRcvd(const uint8_t *data, int len) {
19 int i;
20 i = *((int *)data);
21 Serial.println(i); // just dump the value
22}
23
24int testI = 0;
25
26
27void setup() {
28 Serial.begin(115200);
29 delay(100);
30 Serial.println("test");
31
32 // init esp32 esp_now protocol use 72 as broadcast ID: See in expsimplenow.h to see the whole mac address
34}
35
36void txTest() {
37 // lets send testI integer out in the sky :-)
38 espSimpleNowBroadcastData((char *)(&testI), sizeof(int));
39
40 testI++;
41
42 delay(500);
43}
44
45void loop() {
46
47 // ifs using this code as TX part uncomment the line below
48 // otherwise this code it act as RX part
49
50
51 //txTest();
52}
uint8_t espSimpleNowBroadcastData(char *data, uint16_t len)
uint8_t espSimpleNowInit(uint8_t macAddrLastByte)
void espSimpleNowCallbackBinRcvd(const uint8_t *data, int len)
int testI
void espSimpleNowCallbackDataSent(const bool success)
void setup()
void txTest()
void loop()