logo elektroda
logo elektroda
X
logo elektroda

ESP-NOW: Communication between two ESPs as transmitter and receiver - diode control

przemcio.18 1302 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19804274
    przemcio.18
    Level 14  
    Hello ... can anyone throw up an example on esp-now of how to write communication between two esp as transmitter and receiver? i don't mean sending temperature measurements or information to the serial port just for example:
    pressing button 1 lights up diode 1 until the button is released
    pressing button 2 lights up LED 2 until the button is released
    pressing buttons 1 and 2 lights both LEDs until the button is released

    or any good tutorial on how to control a RC vehicle, only not on android because I already have one, I converted it to control it from a second esp everything works except the most important thing when I take out the batteries while pressing the button on the remote control, it loses range ... generally when it loses communication with the car it does the last command, the car just does not listen to the remote control to see if it has lost connection :( and just goes where W (far)


    pilot
    Code: C / C++
    Log in, to see the code
    .


    auto
    Code: C / C++
    Log in, to see the code
    [/code].
  • ADVERTISEMENT
  • #2 19824051
    mmaker
    Level 19  
    Hi. I now have a similar task of creating a control for an RC crane for a child. Yesterday I tried from all the available tutorials to create a connection after ESP NOW between ESP32 (receiver due to the large amount of GPIO) and ESP8266 (as remote control). Unfortunately from most of this information I failed to create a working connection except for one which I gave up on anyway.... I now have a working set up to control 3 DC motors only that both sides are ESP8266 with one-way transmission and for the moment there is the same problem you write about, but I think it is easily circumvented in several ways. A bit short of pins to use but I'll want to get around this with a sliding register ;) .

    The code looks like this for the transmitter:
    Code: C / C++
    Log in, to see the code
    .

    For the receiver it looks like this:
    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #3 19824705
    przemcio.18
    Level 14  
    I have resolved the issue with two-way control.... In the sense the remote control sends commands and the car only. It sends. Data to check if it is in range... And it works instantly... I focused. I focused later on the operation of the car 9 speed modes, control from the driver's position activated by the remote etc. Tomorrow I'll post the codes, I'll just sort them out of the unnecessary uncommented commands to make them more readable for the other person.... The principle of the combo program is basically simple these two sketches only difference is that in one you transmit data and in the other you receive.... 😊😅 But when you start sending something one function at a time it. It's easier to get into a trance of understanding 🥴😅
    In esp-now, of course. I managed from esp8266 position to get 6 button and 3 led max. And a free adc input pin due to the design of the remote I could not use analogue control without upgrading the housing.... Only buttons alone "front" "back" "right" "left" "S" "stop" and led1 led 2 led3. As for. Esp 32 I haven't had the pleasure yet but some topics have passed under my hand....
  • ADVERTISEMENT
  • #4 19824866
    mmaker
    Level 19  
    In my case the transmission is one-way Pilot --> Receiver and on the receiver I check if there is a connection in such a way that I send a packet with the remote control every 100ms whether a button is pressed or not and on the receiver every second I compare the values of the counter of these packets from the previous reading with the current one. If the readings are different then I reset the connection loss flag, if the readings are the same then I set 1.
    Code: C / C++
    Log in, to see the code
    .
  • #5 20066491
    ezbig
    Level 20  
    przemcio.18 wrote:
    Hello ... can anyone throw up an example on esp-now how to write communication between two esp as transmitter and receiver? i don't mean sending temperature measurements or information to the serial port just for example:
    pressing button 1 lights up diode 1 until the button is released
    pressing button 2 lights up LED 2 until the button is released
    pressing buttons 1 and 2 lights both LEDs until the button is released

    or any good tutorial on how to control a RC vehicle, only not on android because I already have one, I converted it to control it from a second esp everything works except the most important thing when I take out the batteries while pressing the button on the remote control, it loses range ... generally when it loses communication with the car it does the last command, the car just doesn't listen to the remote control to see if it has lost connection and just drives where W (far away)


    Did you build this car? As far as I can see, there is no use of ESP-NOW in your code

    https://github.com/un0038998/ESPNOW_Car
    https://www.youtube.com/watch?v=uNXP95vOytw
ADVERTISEMENT