<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[LoPy to LoPy communication issue with button]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am new to the Pycom platform and I am trying to get a LoPy to communicate over LoRa with another LoPy when a button is pressed.</p>
<p dir="auto">I have tried the LoPy to LoPy example code and have this working fine: <a href="https://docs.pycom.io/tutorials/networks/lora/module-module/" target="_blank" rel="noopener noreferrer nofollow">https://docs.pycom.io/tutorials/networks/lora/module-module/</a></p>
<p dir="auto">I now have a breadboard set up with a momentary pushbutton connected to digital pin 9 through the Expansion 3 board.</p>
<p dir="auto">The issue I am having is that when I push the button, I believe the LoPy is sending a LoRa signal as I am printing to the console after the packet is sent but the receiving LoPy is not receiving the signal.</p>
<p dir="auto">In its simplest form, the code below is how I am trying to send and receive the LoRa signal:</p>
<pre><code>from network import LoRa
from machine import Pin
import pycom
import socket
import time

lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868)
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setblocking(False)
pycom.heartbeat(False)

activateButton = Pin('P9', mode=Pin.IN)

print('Starting to send....')

while True:

    if (activateButton() == 1):
        s.send('Hi')
        print('Signal sent')

    time.sleep(1)
</code></pre>
<pre><code>from network import LoRa
import pycom
import socket
import time

lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868)
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setblocking(False)
pycom.heartbeat(False)

print('Starting')
while True:
    if s.recv(64) == b'Hi':
        print('Signal received')

    time.sleep(1)
</code></pre>
<p dir="auto">I have tried various other ways of coding the same thing. I have also tried to just modify the LoPy to LoPy example, which works, but instead of just sending a signal automatically I send it when I push the button. Once again this does not have the desired outcome on the receiving side.</p>
<p dir="auto">I have been at this for days now and have searched through community postings but cannot find anything that can point me in the right direction.</p>
<p dir="auto">From what I can gather, what I am doing is very simple and should work.</p>
<p dir="auto">I am also having an issue where by after sending 8-14 LoRa packets I get an EAGAIN error.</p>
<p dir="auto">Please let me know where I am going wrong.</p>
<p dir="auto">Thank you</p>
]]></description><link>https://forum.pycom.io/topic/6763/lopy-to-lopy-communication-issue-with-button</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Mar 2026 16:16:14 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/6763.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Jan 2021 22:42:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to LoPy to LoPy communication issue with button on Tue, 19 Jan 2021 22:45:12 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am new to the Pycom platform and I am trying to get a LoPy to communicate over LoRa with another LoPy when a button is pressed.</p>
<p dir="auto">I have tried the LoPy to LoPy example code and have this working fine: <a href="https://docs.pycom.io/tutorials/networks/lora/module-module/" target="_blank" rel="noopener noreferrer nofollow">https://docs.pycom.io/tutorials/networks/lora/module-module/</a></p>
<p dir="auto">I now have a breadboard set up with a momentary pushbutton connected to digital pin 9 through the Expansion 3 board.</p>
<p dir="auto">The issue I am having is that when I push the button, I believe the LoPy is sending a LoRa signal as I am printing to the console after the packet is sent but the receiving LoPy is not receiving the signal.</p>
<p dir="auto">In its simplest form, the code below is how I am trying to send and receive the LoRa signal:</p>
<pre><code>from network import LoRa
from machine import Pin
import pycom
import socket
import time

lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868)
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setblocking(False)
pycom.heartbeat(False)

activateButton = Pin('P9', mode=Pin.IN)

print('Starting to send....')

while True:

    if (activateButton() == 1):
        s.send('Hi')
        print('Signal sent')

    time.sleep(1)
</code></pre>
<pre><code>from network import LoRa
import pycom
import socket
import time

lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868)
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setblocking(False)
pycom.heartbeat(False)

print('Starting')
while True:
    if s.recv(64) == b'Hi':
        print('Signal received')

    time.sleep(1)
</code></pre>
<p dir="auto">I have tried various other ways of coding the same thing. I have also tried to just modify the LoPy to LoPy example, which works, but instead of just sending a signal automatically I send it when I push the button. Once again this does not have the desired outcome on the receiving side.</p>
<p dir="auto">I have been at this for days now and have searched through community postings but cannot find anything that can point me in the right direction.</p>
<p dir="auto">From what I can gather, what I am doing is very simple and should work.</p>
<p dir="auto">I am also having an issue where by after sending 8-14 LoRa packets I get an EAGAIN error.</p>
<p dir="auto">Please let me know where I am going wrong.</p>
<p dir="auto">Thank you</p>
]]></description><link>https://forum.pycom.io/post/36635</link><guid isPermaLink="true">https://forum.pycom.io/post/36635</guid><dc:creator><![CDATA[Alex Ray]]></dc:creator><pubDate>Tue, 19 Jan 2021 22:45:12 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy to LoPy communication issue with button on Wed, 20 Jan 2021 14:10:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/7507">@Alex-Ray</a> try logging the return value of the <code>s.recv(64)</code> call, to see if anything has been received, and if so, what.</p>
<p dir="auto">You may also want to explicitly set frequency, bandwidth, spreading factor, etc. I suppose the defaults should be the same in both sides, but it’s always better to know what they are.</p>
]]></description><link>https://forum.pycom.io/post/36653</link><guid isPermaLink="true">https://forum.pycom.io/post/36653</guid><dc:creator><![CDATA[jcaron]]></dc:creator><pubDate>Wed, 20 Jan 2021 14:10:08 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy to LoPy communication issue with button on Wed, 20 Jan 2021 16:20:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/7507">@Alex-Ray</a> One problem I always have with the simple Raw mode LoRa sensing from one device to the other using LoPy4 devices, that it will not work unless I push hard reset at the button on both devices after power on, and then run the code.<br />
Note that lora.reset() still causes a core dump, and besides that is an No-operation on LoPy4.</p>
]]></description><link>https://forum.pycom.io/post/36657</link><guid isPermaLink="true">https://forum.pycom.io/post/36657</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Wed, 20 Jan 2021 16:20:21 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy to LoPy communication issue with button on Fri, 22 Jan 2021 09:12:42 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">I am also having an issue where by after sending 8-14 LoRa packets I get an EAGAIN error.</p>
</blockquote>
<p dir="auto">I would really like to learn more about this error. I custom compiled a firmware for someone earlier this week to determine the cause of this as I cannot reproduce it, would you like to send it to you as well (<a href="https://pycomiot-my.sharepoint.com/:u:/g/personal/gijs_pycom_io/ERB9SiQ5UP5HoTU8u0cQ0b4B7bFqC8pecFiA3aaUlcrQsg?e=0lBKEp" target="_blank" rel="noopener noreferrer nofollow">here</a>). You can use the firmware updater tool to flash from local file, it will provide some additional debug information in that area.</p>
<p dir="auto">Other than that, I have no issues running the example from the documentation (as you mention as well) <a href="https://docs.pycom.io/tutorials/networks/lora/module-module/" target="_blank" rel="noopener noreferrer nofollow">https://docs.pycom.io/tutorials/networks/lora/module-module/</a> and am quite puzzled why yours does not work, as the code does work on my device. Please try the suggestion by <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/1538">@jcaron</a> and maybe add some indication, like changing the color on the RGB LED when a LoRa packet is sent</p>
]]></description><link>https://forum.pycom.io/post/36678</link><guid isPermaLink="true">https://forum.pycom.io/post/36678</guid><dc:creator><![CDATA[Gijs]]></dc:creator><pubDate>Fri, 22 Jan 2021 09:12:42 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy to LoPy communication issue with button on Tue, 26 Jan 2021 14:59:30 GMT]]></title><description><![CDATA[<p dir="auto">Hi Guys,</p>
<p dir="auto">I seemed to have solved this by moving the time.sleep(1) of code into the if statement.</p>
<p dir="auto">This also solved the EAGAIN error that I was receiving.</p>
<p dir="auto">Thank you for the time you all took to reply.</p>
]]></description><link>https://forum.pycom.io/post/36752</link><guid isPermaLink="true">https://forum.pycom.io/post/36752</guid><dc:creator><![CDATA[Alex Ray]]></dc:creator><pubDate>Tue, 26 Jan 2021 14:59:30 GMT</pubDate></item></channel></rss>