<?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[ESP-Now UIFlow to Arduino]]></title><description><![CDATA[<p dir="auto">Dear All,</p>
<p dir="auto">I am trying to send a message using the EspNow blocks in UIFlow to an ESP32 running an Arduino program. The message is sent and received but I can't seem to get the data in the Arduino program it just returns '1' even though the length alters as I alter the data being sent. When I look at the Python code it is sending a string, so I think I'm asking how to convert a Python string into an Arduino string/character array.  Sorry if this is a real newbie question.</p>
<p dir="auto"><strong>Blocky - Python code</strong><br />
def buttonA_wasPressed():<br />
global iCount<br />
espnow.send(id=1, data=str('HELLO!'))<br />
pass<br />
btnA.wasPressed(buttonA_wasPressed)</p>
<p dir="auto"><strong>Arduino ESP-Now receive code</strong><br />
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len)<br />
{<br />
char macStr[18];<br />
char sData[data_len];</p>
<p dir="auto">snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",<br />
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);<br />
Serial.print("Last Packet Recv from: "); Serial.println(macStr);<br />
Serial.print("Data Length: "); Serial.println(data_len);<br />
Serial.print("Last Packet Recv Data: "); Serial.println(*data);<br />
Serial.println("");<br />
}</p>
<p dir="auto"><strong>Arduino Output</strong><br />
11:39:37.342 -&gt; Last Packet Recv from: d8:a0:1d:55:4b:38<br />
11:39:37.342 -&gt; Data Length: 16<br />
11:39:37.342 -&gt; Last Packet Recv Data: 1<br />
11:39:37.342 -&gt;</p>
]]></description><link>https://community.m5stack.com/topic/2202/esp-now-uiflow-to-arduino</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 06:52:00 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2202.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 14 Aug 2020 10:46:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ESP-Now UIFlow to Arduino on Thu, 05 Jan 2023 18:40:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/3659">@xio1996</a> I was trying to do the same thing. I have some ESP01 relay controlers, which they work fine between them aand an ESP32 WROOM. I'm now trying to use a Core2 as a master, but I haven't been able to communicate with the ESP01.</p>
<p dir="auto">Do you have any example codes for Core5 in MicroPython?</p>
<p dir="auto">Thanks in advance<br />
FBP</p>
]]></description><link>https://community.m5stack.com/post/19730</link><guid isPermaLink="true">https://community.m5stack.com/post/19730</guid><dc:creator><![CDATA[fbritop]]></dc:creator><pubDate>Thu, 05 Jan 2023 18:40:22 GMT</pubDate></item><item><title><![CDATA[Reply to ESP-Now UIFlow to Arduino on Fri, 14 Aug 2020 12:45:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi Lukas,</p>
<p dir="auto">Thank you for the link. I will see if I can use their method. I did find a solution that works.</p>
<p dir="auto">I noticed that the received data starting at index 11 was getting ASCII codes so I modified the Arduino code to construct a String starting from that position. The ESP-Now OnDataRecv callback now looks like this (the string construction is in bold).</p>
<p dir="auto">void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len)<br />
{<br />
char macStr[18];</p>
<p dir="auto"><strong>String tData="";<br />
char Ascii[1];<br />
for(int i=10;i&lt;data_len;i++)<br />
{<br />
tData+=(char)data[i];<br />
}</strong></p>
<p dir="auto">snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",<br />
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);</p>
<p dir="auto">Serial.print("Last Packet Recv from: "); Serial.println(macStr);<br />
Serial.print("Data Length: "); Serial.println(data_len);<br />
Serial.print("Last Packet Recv Data: '"); Serial.print(tData);<br />
Serial.println("'");<br />
}</p>
<p dir="auto"><strong>Arduino Output</strong></p>
<p dir="auto">13:38:11.806 -&gt; Last Packet Recv from: d8:a0:1d:55:4b:38<br />
13:38:11.806 -&gt; Data Length: 22<br />
13:38:11.806 -&gt; Last Packet Recv Data: 'Hello World!'</p>
]]></description><link>https://community.m5stack.com/post/9654</link><guid isPermaLink="true">https://community.m5stack.com/post/9654</guid><dc:creator><![CDATA[Xio1996]]></dc:creator><pubDate>Fri, 14 Aug 2020 12:45:27 GMT</pubDate></item><item><title><![CDATA[Reply to ESP-Now UIFlow to Arduino on Fri, 14 Aug 2020 12:08:28 GMT]]></title><description><![CDATA[<p dir="auto">Hey</p>
<p dir="auto">since you pass a pointer to the println-function and the cpu does not know what type of data is located at that position this behaviours seems normal.<br />
In the example in the link they create a structure for the transmitted data. In the callback they copy the recieved data in this structure and later you can print exactly what you want:<br />
<a href="https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/" target="_blank" rel="noopener noreferrer nofollow ugc">https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/</a></p>
]]></description><link>https://community.m5stack.com/post/9652</link><guid isPermaLink="true">https://community.m5stack.com/post/9652</guid><dc:creator><![CDATA[lukas]]></dc:creator><pubDate>Fri, 14 Aug 2020 12:08:28 GMT</pubDate></item></channel></rss>