<?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[M5Dial RFID not working in UIFlow 2.0]]></title><description><![CDATA[<p dir="auto">I was making a simple program that should be able to pair to an NFC/RFID card using its UID and then be able to compare the saved UID against another scanned card's UID.</p>
<p dir="auto">This is the Python code output from UIFlow:</p>
<pre><code class="language-python">import os, sys, io
import M5
from M5 import *
from hardware import *
import time



mode = None
status = None
rfid = None


savedcard = None

# Describe this function...
def pair():
  global savedcard, mode, status, rfid
  Speaker.tone(3500, 50)
  Widgets.fillScreen(0xff6600)
  mode.setText(str('Setup Mode'))
  status.setText(str('Scan tag to pair'))
  while not (rfid.is_new_card_present()):
    continue
  savedcard = rfid.read_card_uid()
  status.setText(str(str((rfid.read_card_uid()))))
  time.sleep(1)
  Speaker.tone(3500, 50)
  reset()

# Describe this function...
def active():
  global savedcard, mode, status, rfid
  Widgets.fillScreen(0x666666)
  if savedcard == None:
    mode.setText(str('Active Mode'))
    status.setText(str('No tag paired'))
    time.sleep(1)
    pair()
  else:
    mode.setText(str('Active Mode'))
    status.setText(str('Waiting for tag'))
    while not (rfid.is_new_card_present()):
      pass
    if (rfid.read_card_uid()) == savedcard:
      Widgets.fillScreen(0x33cc00)
      status.setText(str('Access granted'))
      Speaker.tone(3500, 50)
      time.sleep(1)
    else:
      Widgets.fillScreen(0xcc0000)
      status.setText(str('Access denied'))
      for count in range(3):
        Speaker.tone(3500, 50)
        time.sleep_ms(60)
      time.sleep(1)
  reset()

# Describe this function...
def reset():
  global savedcard, mode, status, rfid
  Widgets.fillScreen(0x000000)
  mode.setText(str('Idle'))
  status.setText(str('Click to wake'))


def btnA_wasClicked_event(state):
  global mode, status, rfid, savedcard
  active()


def btnA_wasHold_event(state):
  global mode, status, rfid, savedcard
  pair()


def setup():
  global mode, status, rfid, savedcard

  rfid = RFID()
  M5.begin()
  mode = Widgets.Label("[mode]", 36, 87, 1.0, 0xffffff, 0x000000, Widgets.FONTS.DejaVu18)
  status = Widgets.Label("[status]", 35, 122, 1.0, 0xffffff, 0x000000, Widgets.FONTS.DejaVu18)

  BtnA.setCallback(type=BtnA.CB_TYPE.WAS_CLICKED, cb=btnA_wasClicked_event)
  BtnA.setCallback(type=BtnA.CB_TYPE.WAS_HOLD, cb=btnA_wasHold_event)

  reset()
  Speaker.setVolumePercentage(1)


def loop():
  global mode, status, rfid, savedcard
  M5.update()


if __name__ == '__main__':
  try:
    setup()
    while True:
      loop()
  except (Exception, KeyboardInterrupt) as e:
    try:
      from utility import print_error_msg
      print_error_msg(e)
    except ImportError:
      print("please update to latest firmware")

</code></pre>
<p dir="auto">When I hold the button to enter Setup Mode and scan a tag, the output of the UID read always comes out as "None" meaning nothing's there. I don't know why this is happening, so this is why I'm sending this as a bug report.</p>
]]></description><link>https://community.m5stack.com/topic/6091/m5dial-rfid-not-working-in-uiflow-2-0</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 07:23:35 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6091.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 15 Feb 2024 05:31:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5Dial RFID not working in UIFlow 2.0 on Thu, 15 Feb 2024 10:52:25 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/84551">@LittleBit670</a></p>
<p dir="auto">I think reading the UUID twice in a short time could be the issue. Try changing below line:</p>
<pre><code>#  status.setText(str(str((rfid.read_card_uid()))))
  status.setText(str(savedcard))
</code></pre>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/23825</link><guid isPermaLink="true">https://community.m5stack.com/post/23825</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Thu, 15 Feb 2024 10:52:25 GMT</pubDate></item></channel></rss>