<?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[cardkb GetKey comparison]]></title><description><![CDATA[<p dir="auto">Hello<br />
I'm trying to read the cardkb buttons to do something (see screenshot). On the display of the m5stack I can see the values when I release the buttons on the cardkb, however, the values for my red, green, blue variables always stay zero. Any insights on what I'm doing wrong?<br />
<img src="/assets/uploads/files/1594028704522-5babf40d-7090-4413-8da9-edf118d937b4-grafik.png" alt="0_1594028703632_5babf40d-7090-4413-8da9-edf118d937b4-grafik.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/topic/2098/cardkb-getkey-comparison</link><generator>RSS for Node</generator><lastBuildDate>Sun, 03 May 2026 17:25:35 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2098.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Jul 2020 09:47:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to cardkb GetKey comparison on Sat, 11 Jul 2020 08:32:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a><br />
sure, here you go:<br />
It didn't seem to matter where I put key = getKey, also it's really messy, but it's working for now.<br />
<img src="/assets/uploads/files/1594456315352-cardkb1.png" alt="0_1594456304041_cardKB1.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/9309</link><guid isPermaLink="true">https://community.m5stack.com/post/9309</guid><dc:creator><![CDATA[xkcd]]></dc:creator><pubDate>Sat, 11 Jul 2020 08:32:58 GMT</pubDate></item><item><title><![CDATA[Reply to cardkb GetKey comparison on Sat, 11 Jul 2020 07:24:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/xkcd" aria-label="Profile: xkcd">@<bdi>xkcd</bdi></a> said in <a href="/post/9299">cardkb GetKey comparison</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/world101" aria-label="Profile: world101">@<bdi>world101</bdi></a> said in <a href="/post/9280">cardkb GetKey comparison</a>:</p>
<blockquote>
<p dir="auto">getKey seems to return a hex value not decimal. So your if condition = 180, 181, 182, 183 is not being satisfied and the do is never executed. Try converting hex to decimal first, before your if statements. Or you can try comparing on the string values B4, B5, B6, B7 or 0xB4, 0xB5, 0xB6, 0xB7. I don’t have a CardKB to test with, so it might take some trial and error.</p>
</blockquote>
<p dir="auto">I suspected this at the very beginning. I can't put B4 in the numerical field (obviously), but I can input 0xB4 - which immediately gets converted to 180.<br />
When I press the '1' Button on the cardKB, GetKey returns 49 - which equals 0x31, the ASCII Code for '1'.<br />
It feels like the condition isn't true for long enough...</p>
<p dir="auto">Edit: It seems I just figured it out. I have to set a variable with the getKey function, if I then check the value of the variable, it works...</p>
</blockquote>
<p dir="auto">Can you share the working code as I'm yet to start work on both of the keyboards?</p>
]]></description><link>https://community.m5stack.com/post/9308</link><guid isPermaLink="true">https://community.m5stack.com/post/9308</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sat, 11 Jul 2020 07:24:34 GMT</pubDate></item><item><title><![CDATA[Reply to cardkb GetKey comparison on Fri, 10 Jul 2020 17:35:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/world101" aria-label="Profile: world101">@<bdi>world101</bdi></a> said in <a href="/post/9280">cardkb GetKey comparison</a>:</p>
<blockquote>
<p dir="auto">getKey seems to return a hex value not decimal. So your if condition = 180, 181, 182, 183 is not being satisfied and the do is never executed. Try converting hex to decimal first, before your if statements. Or you can try comparing on the string values B4, B5, B6, B7 or 0xB4, 0xB5, 0xB6, 0xB7. I don’t have a CardKB to test with, so it might take some trial and error.</p>
</blockquote>
<p dir="auto">I suspected this at the very beginning. I can't put B4 in the numerical field (obviously), but I can input 0xB4 - which immediately gets converted to 180.<br />
When I press the '1' Button on the cardKB, GetKey returns 49 - which equals 0x31, the ASCII Code for '1'.<br />
It feels like the condition isn't true for long enough...</p>
<p dir="auto">Edit: It seems I just figured it out. I have to set a variable with the getKey function, if I then check the value of the variable, it works...</p>
]]></description><link>https://community.m5stack.com/post/9299</link><guid isPermaLink="true">https://community.m5stack.com/post/9299</guid><dc:creator><![CDATA[xkcd]]></dc:creator><pubDate>Fri, 10 Jul 2020 17:35:03 GMT</pubDate></item><item><title><![CDATA[Reply to cardkb GetKey comparison on Thu, 09 Jul 2020 09:52:57 GMT]]></title><description><![CDATA[<p dir="auto">getKey seems to return a hex value not decimal. So your if condition = 180, 181, 182, 183 is not being satisfied and the do is never executed. Try converting hex to decimal first, before your if statements. Or you can try comparing on the string values B4, B5, B6, B7 or 0xB4, 0xB5, 0xB6, 0xB7. I don’t have a CardKB to test with, so it might take some trial and error.</p>
]]></description><link>https://community.m5stack.com/post/9280</link><guid isPermaLink="true">https://community.m5stack.com/post/9280</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Thu, 09 Jul 2020 09:52:57 GMT</pubDate></item><item><title><![CDATA[Reply to cardkb GetKey comparison on Wed, 08 Jul 2020 16:45:44 GMT]]></title><description><![CDATA[<p dir="auto">I just tried to use change and put different values, but the outcome is the same - none of the "do" parts get executed through the "get Key" condition.<br />
They do get executed when through the A B C Buttons though.</p>
]]></description><link>https://community.m5stack.com/post/9277</link><guid isPermaLink="true">https://community.m5stack.com/post/9277</guid><dc:creator><![CDATA[xkcd]]></dc:creator><pubDate>Wed, 08 Jul 2020 16:45:44 GMT</pubDate></item><item><title><![CDATA[Reply to cardkb GetKey comparison on Tue, 07 Jul 2020 20:58:39 GMT]]></title><description><![CDATA[<p dir="auto">My understanding from the way it goes wrong on my projects.<br />
Set is used to set the initial state.<br />
to alter the value of the initial state, you need to change.</p>
]]></description><link>https://community.m5stack.com/post/9262</link><guid isPermaLink="true">https://community.m5stack.com/post/9262</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Tue, 07 Jul 2020 20:58:39 GMT</pubDate></item><item><title><![CDATA[Reply to cardkb GetKey comparison on Tue, 07 Jul 2020 15:45:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a> I'd like to know the reasoning behind this. Can't imagine I can't just set a value. I tried to debug a little more:<br />
The rectangle changes color (and the values change as well) when i press one of the 3 buttons on the m5stack, but not if I press the keys on the card.<br />
What is the return type of the get Key function? As it says ASCII value I assume it's an integer, but it's not triggering anything.<br />
<img src="/assets/uploads/files/1594136553473-02e2bd28-5066-41b6-8589-f25782ac1c82-grafik.png" alt="0_1594136547556_02e2bd28-5066-41b6-8589-f25782ac1c82-grafik.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/9259</link><guid isPermaLink="true">https://community.m5stack.com/post/9259</guid><dc:creator><![CDATA[xkcd]]></dc:creator><pubDate>Tue, 07 Jul 2020 15:45:19 GMT</pubDate></item><item><title><![CDATA[Reply to cardkb GetKey comparison on Mon, 06 Jul 2020 20:02:57 GMT]]></title><description><![CDATA[<p dir="auto">Use change not set.</p>
]]></description><link>https://community.m5stack.com/post/9253</link><guid isPermaLink="true">https://community.m5stack.com/post/9253</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Mon, 06 Jul 2020 20:02:57 GMT</pubDate></item></channel></rss>