[Return to PS70 Networking menu](../index.html)
###Notes on Simple examples
Rui Santos (random nerd) [tutorial on one-way ESP NOW](https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/).
Well-done tutorial, sends data in the form of a structure. Good example of how to do this. First code below sends a single byte.
First, get mac addresses of boards. [Here is a sketch](../mac_address/mac_address.ino)
- [code for one-way byte transmit](One-way_send02.txt)
- [code for one-way byte receive](One-way_rec02.txt)
- [code for one-way packet transmit](One-way_send01.txt)
- [code for one-way packet receive](One-way_rec01.txt)
Next, Santos does a [tutorial](https://randomnerdtutorials.com/esp-now-two-way-communication-esp32/) on two-way sending. This is completely asynchronous - the callback function for receiving puts the result in a memory location that can be accessed as needed. The tutorial code shows how to use a commercially available sensor and an OLED. I simplified the code so that each board receives a byte, adds one, and sends it back. At some point, I expect them to get out of synch, so that subsequent readings are not different by two, but have not seen this yet.
- [code for two-way byte transmit](two-way_00.txt)
Later on, use this code to send potentiometer reading to motor control board for PWM, one way:
- [code for sending](./send01_may28.txt)
- [code for receiving](./rec01_may28.txt)
[hello-world for ESP NOW at hackaday](https://hackaday.io/project/164132-hello-world-for-esp-now) uses a different mode of sending, in which one device broadcasts to all devices in range.
###More notes
Here are notes taken as I worked with ESP NOW
- ADC2 pins cannot be used while using ESPNOW. See [this article](https://github.com/espressif/arduino-esp32/issues/102) from the esp32 forum.
Or [this](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html) link to the Espressif API. ADC 1 pins are okay - that's 32-39, which, for the adafruit Huzzah, includes 32=A7,33=A9, 34=A2, 36= A4, 39=A3.