Exemplo n.º 1
0
    def test__spi_transfer(self):
        # arrange
        sut = MFRC522()
        sut.spi.xfer2 = mock.MagicMock(return_value=[125, 6, 6, 0])
        data = [1, 2, 3]

        # act
        actual = sut._spi_transfer(data)
Exemplo n.º 2
0
 def __init__(self, map_path):
     GPIO.setmode(GPIO.BCM)
     self.logger = logging.getLogger("musicbox")
     self.reader = MFRC522()
     self.end = False
     with open(map_path) as file:
         self.playlist_map = yaml.full_load(file)
         self.logger.info("Loading RFID playlist mapping")
         
     self.mpc = MPDClient()
     self.last_card_id = 0
Exemplo n.º 3
0
def read_f():

    # Hook the SIGINT
    signal.signal(signal.SIGINT, end_read)

    # Create an object of the class MFRC522
    MIFAREReader = MFRC522()

    # Welcome message
    print("Welcome to the MFRC522 data read example")
    print("Press Ctrl-C to stop.")

    # This loop keeps checking for chips. If one is near it will get the UID and authenticate
    while continue_reading:

        # Scan for cards
        (status,
         TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL)

        # If a card is found
        if status == MIFAREReader.MI_OK:
            print("Card detected")

        # Get the UID of the card
        (status, uid) = MIFAREReader.MFRC522_Anticoll()

        # If we have the UID, continue
        if status == MIFAREReader.MI_OK:

            # Print UID
            print("Card read UID: {},{},{},{}".format(uid[0], uid[1], uid[2],
                                                      uid[3]))

            # This is the default key for authentication
            key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]

            # Select the scanned tag
            MIFAREReader.MFRC522_SelectTag(uid)

            # Authenticate
            status = MIFAREReader.MFRC522_Auth(MIFAREReader.PICC_AUTHENT1A, 8,
                                               key, uid)

            # Check if authenticated
            if status == MIFAREReader.MI_OK:
                MIFAREReader.MFRC522_Read(8)
                MIFAREReader.MFRC522_StopCrypto1()
                print("Authentication success")
                clean()
                return ("{},{},{},{}".format(uid[0], uid[1], uid[2], uid[3]))
            else:
                print("Authentication error")
Exemplo n.º 4
0
 def __init__(self,
              key=[0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
              block_addrs=[8, 9, 10]):
     super(SUCS_RFID, self).__init__()
     self.KEY = key
     self.BLOCK_ADDRS = block_addrs
     self.BlockAddr = 5
     self.listen_state = False
     self.data_flag = True
     self.card_id = None
     self.card_text = None
     self.rfidScanSchedule = None
     self.READER = MFRC522(bus=1, device=0, pin_rst=37)
Exemplo n.º 5
0
 def plugin_init(self, enableplugin=None):
     plugin.PluginProto.plugin_init(self, enableplugin)
     self.decimals[0] = -1
     self.initialized = False
     if self.enabled:
         try:
             spil = self.spi
         except:
             spil = -1
         try:
             rstpin = self.taskdevicepin[0]
         except:
             rstpin = -1
             spil = -1
         try:
             ipin = self.taskdevicepin[1]
         except:
             ipin = -1
             spil = -1
         if spil > -1:
             try:
                 gpios.HWPorts.remove_event_detect(int(ipin))
             except:
                 pass
             try:
                 self.reader = MFRC522(bus=spil,
                                       device=self.spidnum,
                                       pin_rst=rstpin)
                 self.initialized = True
                 self.timer100ms = True
                 self.readinprogress = 0
                 self.trigger = 0
                 self.lastread = 0
                 try:
                     if ipin > -1:
                         gpios.HWPorts.add_event_detect(
                             int(ipin), gpios.FALLING, self.callback)
                 except:
                     pass
                 self.rc_clear_irq()
                 misc.addLog(rpieGlobals.LOG_LEVEL_DEBUG, "RC522 init ok")
             except Exception as e:
                 self.initialized = False
                 misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,
                             "RC522 init error:" + str(e))
     if self.initialized == False:
         self.timer100ms = False
Exemplo n.º 6
0
 def __init__(self,window):
     self.window = window
     #init buzzer
     GPIO.setmode(GPIO.BCM)
     GPIO.setup(self.BUZZER, GPIO.OUT)
     self.buzzer = GPIO.PWM(self.BUZZER,50)
     self.buzzer.start(50)
     
     #init LCD
     self.message_lcd = lcd()
     
     #init RFID
     self.previousUid = []
     self.MIFAREReader = MFRC522()
     self.rfidStatusHandler()
     
     #init firebase
     cred = credentials.Certificate('/home/pi/Documents/certificate/raspberrypi-f3174-firebase-adminsdk-bbufq-63a19debda.json')
     firebase_admin.initialize_app(cred)
     self.firestore = firestore.client()
Exemplo n.º 7
0
    def __init__(self, spi_bus=0, spi_device=0, reset_pin):
        self._Reader = MFRC522(bus=spi_bus,
                               device=spi_device,
                               pin_rst=reset_pin)
        self._IsScannig = True
        self._InterObs = Common.Observable()

        def loop():
            (status,
             _) = self._Reader.MFRC522_Request(self._Reader.PICC_REQIDL)

            if self._IsScannig and status == self._Reader.MI_OK:
                (status, uid) = self._Reader.MFRC522_Anticoll()

                if status == self._Reader.MI_OK:
                    print("UID: " + str(uid[0]) + "," + str(uid[1]) + "," +
                          str(uid[2]) + "," + str(uid[3]))
                    strUID = str(uid[0]) + "," + str(uid[1]) + "," + str(
                        uid[2]) + "," + str(uid[3])
                    self._InterObs.emit(strUID)

        timer = Common.SensorTimer(loop)
        timer.start(0.5)
Exemplo n.º 8
0
 def create_rc522(self):
     self.rc522 = MFRC522(self.rc522_pins["sck"], self.rc522_pins["mosi"],
                          self.rc522_pins["miso"], self.rc522_pins["rst"],
                          self.rc522_pins["sda"])
Exemplo n.º 9
0
#1/usr/in/env python3

import RPi.GPIO as GPIO
from mfrc522 import MFRC522

reader = MFRC522()

try:
    content = reader.Read_MFRC522()
    print("Content: ", content)

finally:
    GPIO.cleanup()
Exemplo n.º 10
0
readerSpi.init()
agnostic.collect()

screenMiso = Pin(16)
screenMosi = Pin(5)
screenSck = Pin(4)
screenSpi = SPI(-1,
                baudrate=1800000,
                polarity=0,
                phase=0,
                miso=screenMiso,
                mosi=screenMosi,
                sck=screenSck)
agnostic.collect()

rdr = MFRC522(spi=readerSpi, gpioRst=None,
              gpioCs=2)  # equivalent to reset D3 (was CableSelect D4)
agnostic.collect()

screen = Screen(
    spi=screenSpi, slaveSelectPin=None, resetDisplayPin=None
)  # GPIO15 alleged SS in hardware driver! ( https://tttapa.github.io/ESP8266/Chap04%20-%20Microcontroller.html )
agnostic.collect()


def plotter(x, y):
    if x < 128 and y < 64:
        screen.plot(x, y, set=True)
    else:
        print("Out of bounds {},{}".format(x, y))

Exemplo n.º 11
0
 def __init__(self, rst):
     self.READER = MFRC522(pin_rst=rst)
Exemplo n.º 12
0
def loop(rfid):
    global b_new_int
    if b_new_int:  # new read interrupt
        print()
        print('Interrupt')
        # Select one of the cards
        result, uid = rfid.picc_read_card_serial()
        if not result:
            return
        print('Card UID: {}'.format(uid))
        rfid.picc_halt_a()
        print()
        clear_int(rfid)
        b_new_int = False

    # The receiving block needs regular retriggering (tell the tag it should transmit??)
    # (mfrc522.PCD_WriteRegister(mfrc522.FIFODataReg,mfrc522.PICC_CMD_REQA);)
    activate_rec(rfid)


rfid = MFRC522()
try:
    setup(rfid)
    while run:
        print('.', end='')
        loop(rfid)
        sleep(0.1)

finally:
    rfid.pcd_cleanup()
Exemplo n.º 13
0
 def __init__(self, spd=200):
     self.READER = MFRC522(spd=spd)
Exemplo n.º 14
0
from mfrc522 import MFRC522


def uidToString(uid):
    mystring = ""
    for i in uid:
        mystring = "%02X" % i + mystring
    return mystring


reader = MFRC522(spi_id=0, sck=2, miso=4, mosi=3, cs=1, rst=0)

try:
    while True:
        (stat, tag_type) = reader.request(reader.REQIDL)
        succes = []
        if stat == reader.OK:
            (stat, uid) = reader.SelectTagSN()
            """keys = [
        [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF],
        [0xA0,0xA1,0xA2,0xA3,0xA4,0xA5],
        [0xD3,0xF7,0xD3,0xF7,0xD3,0xF7],
        [0x00,0x00,0x00,0x00,0x00,0x00],

        [0xB0,0xB1,0xB2,0xB3,0xB4,0xB5],
        [0x4D,0x3A,0x99,0xC3,0x51,0xDD],
        [0x1A,0x98,0x2C,0x7E,0x45,0x9A],
        [0xAA,0xBB,0xCC,0xDD,0xEE,0xFF],
        [0x71,0x4C,0x5C,0x88,0x6E,0x97],
        [0x58,0x7E,0xE5,0xF9,0x35,0x0F],
        [0xA0,0x47,0x8C,0xC3,0x90,0x91],
Exemplo n.º 15
0
screen.clear()
font.draw_line("Hello World", plotter)
screen.redraw()
report_collect()

report_import("milecastles")
report_import("boilerplate")
report_import("engines")
report_import("engines.console")
report_import("stories.senhouse")
from stories.senhouse import story

from regimes.console import ConsoleSiteEmulator

emulator = ConsoleSiteEmulator(story=story)
report_collect()

report_import("mfrc522")
from mfrc522 import MFRC522

rdr = MFRC522(0, 2, 4, 5, 14)

(stat, tag_type) = rdr.request(rdr.REQIDL)
if stat == rdr.OK:
    (stat, raw_uid) = rdr.anticoll()
    if stat == rdr.OK:
        para = "ID is\n0x%02x%02x%02x%02x" % (raw_uid[0], raw_uid[1],
                                              raw_uid[2], raw_uid[3])
        screen.clear()
        font.draw_para(para, plotter)
        screen.redraw()
Exemplo n.º 16
0
def run(so):
    pin_in = []
    oled_width = 1
    oled_heigth = -1
    oled = 0
    adc = 0
    i2c_msg = 0
    send_type = 0  # 0: data, 1: nfc, 2: adc
    #so.settimeout(0.05)
    disp = False
    data = b''
    rdr = 0
    nfc = '0'
    while (1):
        #so.setsockopt(socket.TCP_NODELAY,1)

        s = b''
        '''try:
            s=so.recv(1024)
        except:
            pass'''

        s = bytes(recv_msg(so))

        d = s
        print(len(s))
        if (len(s) == 1):  # send NFC
            nfc = '0'
            send_type = 1
            if (rdr):
                (stat, _) = rdr.request(rdr.REQIDL)
                if stat == rdr.OK:
                    (stat, raw_uid) = rdr.anticoll()
                    if stat == rdr.OK:
                        nfc = ":%02x%02x%02x%02x:" % (raw_uid[0], raw_uid[1],
                                                      raw_uid[2], raw_uid[3])

        elif (len(s) == 2):  # set Input Pin
            if (not (int(s) in pin_in)):
                pin_in.append(int(s))

        elif (len(s) == 3):  # set Output Pin
            pin = int(int(s) / 10)
            Pin(pin, Pin.OUT).value(int(s) % 10)
            if pin in pin_in:
                pin_in.remove(pin)

        elif (len(s) == 4):  # read ADC
            pin = int(s)
            adc = ADC(pin)
            send_type = 2
            if pin in pin_in:
                pin_in.remove(pin)

        elif (len(s) == 8):  # read I2C
            #print("i2c")
            s = int(s)
            nbytes = s % 100
            s = int(s / 100)
            addr = s % 100
            s = int(s / 100)
            scl = s % 100
            sda = int(s / 100)
            #print(sda,scl,addr,nbytes)

            i2c = I2C(-1, scl=Pin(scl), sda=Pin(sda))
            i2c_msg = i2c.readfrom(addr, nbytes)
            send_type = 3
            #print(i2c_msg)

        elif (len(s) == 9):  # set PWM
            s = int(s)
            duty = s % 10000
            s = int(s / 10000)
            freq = s % 1000 + 1
            pin = int(s / 1000)
            PWM(Pin(pin), freq=freq, duty=duty)
            if pin in pin_in:
                pin_in.remove(pin)

        elif (len(s) == 10):  # set NFC
            s = s.decode()
            sda = int(s[-2:])
            s = int(s[:-2])
            rst = s % 100
            s = int(s / 100)
            miso = s % 100
            s = int(s / 100)
            mosi = s % 100
            s = int(s / 100)
            sclk = s % 100
            from mfrc522 import MFRC522
            rdr = MFRC522(sclk, mosi, miso, rst, sda)

        elif (len(s) == 11):  # set Neopixel
            s = int(s)
            val = [0, 0, 0]
            val[2] = (s % 1000)
            s = int(s / 1000)
            val[1] = (s % 1000)
            s = int(s / 1000)
            val[0] = (s % 1000)
            pin = int(s / 1000)
            np = neopixel.NeoPixel(Pin(pin), 1)
            np[0] = val
            np.write()
            if pin in pin_in:
                pin_in.remove(pin)

        elif (len(s) == 12):  #set Display
            s = s.decode()
            disp = int(s[-2:])
            s = s[:-2]
            s = int(s)
            oled_heigth = s % 1000
            s = int(s / 1000)
            oled_width = s % 1000
            s = int(s / 1000)
            scl = s % 100
            sda = int(s / 100)
            i2c = I2C(-1, scl=Pin(scl), sda=Pin(sda))
            print(disp, oled_heigth, oled_width, sda, scl)

            if (disp == 0):
                from sh1106 import SH1106_I2C
                oled = SH1106_I2C(oled_width, oled_heigth, i2c)
            elif (disp == 1):
                from ssd1306 import SSD1306_I2C
                oled = SSD1306_I2C(oled_width, oled_heigth, i2c)

        elif (len(s) != 0):
            p = bytearray(s)
            fbuf = framebuf.FrameBuffer(p, oled_width, oled_heigth,
                                        framebuf.MONO_HLSB)
            oled.blit(fbuf, 0, 0)
            oled.show()

        #****** send ******#
        msg = 0
        if (send_type == 0):
            for p in pin_in:
                msg += ((not Pin(p, Pin.IN, Pin.PULL_UP).value()) << p)

        try:
            if (send_type == 0):
                so.send(str(msg).encode())
            elif (send_type == 1):
                so.send(str(nfc).encode())
            elif (send_type == 2):
                so.send(str(adc).encode())
            elif (send_type == 3):
                so.send(i2c_msg)

            send_type = 0
        except:
            import machine
            machine.reset()
Exemplo n.º 17
0
    * selectTag calling isPresentTag() when selectTag already triggered by presence, (call is implied by readCard)
    * gc.collect() or spurious array allocations
    * repeated reauthentication against blocks
    * repeated reselect of cards
* Avoid...
    * reading card when possible
        * same card within a 'paging delay' must have same cardData as just written
    * writing card when possible
        * if cardData has not changed
"""

freq(160000000)

spi = SPI(1, baudrate=1800000, polarity=0, phase=0)
spi.init()
cardReader = MFRC522(spi=spi, gpioRst=None, gpioCs=2)
cardVault = BankVault(reader=cardReader)

# red cards are reset cards
resetUids = (b'=\xe5zR\xf0', b'=whRp', b'=eoRe', b'=\x14\x8dR\xf6',
             b'=\x95?R\xc5', b'=Q\xf2R\xcc')
resetCard = False

presenceTimeout = 10000

version = 1
filler = "The Quick Brown Fox Jumped over the Lazy Dog. Nymphs vex quick dwarf jog blitz."
#filler= ""
startData = {"version": version, "counter": 0, "filler": filler}

cardCache = None
Exemplo n.º 18
0
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from machine import Pin, SoftSPI, I2C
from random import randint
from mfrc522 import MFRC522 # https://github.com/vtt-info/MicroPython_MFRC522
from ssd1306 import SSD1306_I2C # https://github.com/stlehmann/micropython-ssd1306

# Configure RFID reader
sda = Pin(14, Pin.OUT)
sck = Pin(15, Pin.OUT)
mosi = Pin(16, Pin.OUT)
miso = Pin(17, Pin.OUT)
spi = SoftSPI(baudrate=100000, polarity=0, phase=0, sck=sck, mosi=mosi, miso=miso)
reader = MFRC522(spi, sda)
KEY = [255, 255, 255, 255, 255, 255]
BLOCK = 20

# Configure OLED Display
WIDTH = 128
HEIGHT = 64
i2c = I2C(1, scl=Pin(19), sda=Pin(18))
oled = SSD1306_I2C(WIDTH, HEIGHT, i2c)
oled.contrast(0)

# First print in terminal and display
print('Place Card In Front Of Device\n')
oled.text('Waiting for card', 0, 0)
oled.show()
Exemplo n.º 19
0
    async def recv(reader):
        args = []
        while True:
            s = bytes(await recv_msg(reader))
            #s=await reader.readline()

            print(chr(s[0]))

            msg_type = chr(s[0])

            msg = None

            if msg_type != 'S':
                msg = s.decode()[1:]
                args = list(map(int, msg.split("-")))
                print(args)
            else:
                msg = s[1:]

            if (msg_type == 'f'):  # read NFC
                flag = args[0]

                if flag:
                    send_type[0] = 1
                else:
                    send_type[0] = 0

            elif (msg_type == 'I'):  # set Input Pin
                pin = args[0]
                if (not (pin in pin_in)):
                    pin_in.append(pin)

            elif (msg_type == 'O'):  # set Output Pin
                pin = args[0]
                value = args[1]
                Pin(pin, Pin.OUT).value(value)
                if pin in pin_in:
                    pin_in.remove(pin)

            elif (msg_type == 'A'):  # read ADC
                flag = args[0]

                if flag:
                    pin = args[1]
                    adc_pin[0] = pin
                    if pin in pin_in:
                        pin_in.remove(pin)
                    send_type[0] = 2
                else:
                    adc_pin[0] = -1
                    send_type[0] = 0

            elif (msg_type == 'i'):  # set I2C
                sda_pin = args[0]
                scl_pin = args[1]

                #i2c = [0, 0, 0]

                isqc[0] = I2C(-1, scl=Pin(scl_pin), sda=Pin(sda_pin))

            elif (msg_type == 'c'):  # read I2C
                flag = args[0]

                if flag:
                    addr = args[1]
                    nbytes = args[2]
                    isqc[1] = addr
                    isqc[2] = nbytes
                    send_type[0] = 3
                    print(send_type, isqc)
                else:
                    send_type[0] = 0

            elif (msg_type == 'P'):  # set PWM
                pin = args[0]
                freq = args[1]
                duty = args[2]

                PWM(Pin(pin), freq=freq, duty=duty)
                if pin in pin_in:
                    pin_in.remove(pin)

            elif (msg_type == 'n'):  # set NFC
                sclk = args[0]
                mosi = args[1]
                miso = args[2]
                rst = args[3]
                sda = args[4]
                from mfrc522 import MFRC522
                nfc_rdr[0] = MFRC522(sclk, mosi, miso, rst, sda)

            elif (msg_type == 'N'):  # set Neopixel
                pin = args[0]
                red = args[1]
                green = args[2]
                blue = args[3]

                np = neopixel.NeoPixel(Pin(pin), 1)
                np[0] = [red, green, blue]
                np.write()
                if pin in pin_in:
                    pin_in.remove(pin)

            elif (msg_type == 'D'):  #set Display
                sda = args[0]
                scl = args[1]
                oled_height = args[3]
                oled_width = args[2]
                oled[0] = oled_width
                oled[1] = oled_height
                disp = args[4]

                i2c = I2C(-1, scl=Pin(scl), sda=Pin(sda))
                print(disp, oled_height, oled_width, sda, scl)

                if (disp == 0):
                    from sh1106 import SH1106_I2C
                    oled[2] = SH1106_I2C(oled_width, oled_height, i2c)
                elif (disp == 1):
                    from ssd1306 import SSD1306_I2C
                    oled[2] = SSD1306_I2C(oled_width, oled_height, i2c)

            elif (msg_type == "S"):
                p = bytearray(msg)
                if oled[0] != '' and oled[1] != '':
                    fbuf = framebuf.FrameBuffer(p, oled[0], oled[1],
                                                framebuf.MONO_HLSB)
                    if oled[2] != '':
                        oled[2].blit(fbuf, 0, 0)
                        oled[2].show()

            yield
Exemplo n.º 20
0
 def __init__(self, id):
     self.READER = MFRC522(device=id)
Exemplo n.º 21
0
GPIO.setup(LED0, GPIO.OUT)
GPIO.setup(LED1, GPIO.OUT)

continue_reading = True


def end_read(signal, frame):
    global continue_reading
    continue_reading = False
    GPIO.cleanup()


signal.signal(signal.SIGINT, end_read)

MIFAREReader = MFRC522()

while continue_reading:
    (status, TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL)
    if status == MIFAREReader.MI_OK:
        print("Card detected")
    (status, uid) = MIFAREReader.MFRC522_Anticoll()
    if status == MIFAREReader.MI_OK:
        print("Card read UID: " + str(uid[0]) + "," + str(uid[1]) + "," +
              str(uid[2]) + "," + str(uid[3]))
        #defaultS
        key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
        MIFAREReader.MFRC522_SelectTag(uid)
        stored_uid = str(uid[0]) + str(uid[1]) + str(uid[2]) + str(uid[3])
        print(stored_uid)
        status = MIFAREReader.MFRC522_Auth(MIFAREReader.PICC_AUTHENT1A, 8, key,
Exemplo n.º 22
0
 def simpleMFRC522__init(
     _self, bus, device
 ):  # monkey patch SimpleMFRC522 to support bus and device parameter
     _self.READER = MFRC522(bus=bus, device=device)
Exemplo n.º 23
0
from st7920 import Screen
from mfrc522 import MFRC522
from machine import Pin,SPI
from engines import dictToCard, cardToDict
from engines import Engine
from regimes.console import ConsoleHost
from vault import BankVault
#TODO CH normalise this story module info into one place (e.g. loader, or via milecastles.loadStory)
from stories.corbridge import story
agnostic.collect()

spi = SPI(1, baudrate=1000000, polarity=0, phase=0)
spi.init()
agnostic.collect()

reader = MFRC522(spi=spi, gpioRst=0, gpioCs=2)
agnostic.collect()

vault = BankVault(reader)
agnostic.collect()

screen = Screen(spi=spi, slaveSelectPin=Pin(15))
agnostic.collect()

# TODO CH remove this test function (actual plotter is in avatap engine)
def plotter(x,y):
    screen.plot(x,y)

# TODO CH remove this test function
def generatorFactory():
    yield "Starting!\n"
Exemplo n.º 24
0
 def __init__(self):
   self.READER = MFRC522()
Exemplo n.º 25
0
spi = SPI(0)
spi.init(baudrate=2000000, polarity=0, phase=0)
print(spi)
cs = Pin(5)
dc = Pin(4)
rst = Pin(8)
lcd = pcd8544.PCD8544(spi, cs, dc, rst)
buffer = bytearray((lcd.height // 8) * lcd.width)
framebuf = framebuf.FrameBuffer(buffer, lcd.width, lcd.height,
                                framebuf.MONO_VLSB)

xor_key = []
entered_pin = ""
pin_digit = 0
key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
reader = MFRC522(spi_id=1, sck=14, miso=12, mosi=15, cs=13, rst=20)
blocks = [
    1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 14, 16, 17, 18, 20, 21, 22, 24, 25, 26,
    28, 29, 30, 32, 33, 34, 36, 37, 38, 40, 41, 42, 44, 45, 46, 48, 49, 50, 52,
    53
]
data = []
wallet_types = {
    "BTC ": (34, 52),
    "LTC ": (34, 51),
    "NANO": (60, 64),
    "BAN ": (60, 64),
    "DOGE": (34, 51)
}
wallets = []
wallet_index = 0
Exemplo n.º 26
0
from mfrc522 import MFRC522
import RPi.GPIO as GPIO

READER = MFRC522()
while True:
    (status, TagType) = READER.MFRC522_Request(READER.PICC_REQIDL)
    if status != READER.MI_OK:
        print('0')
        continue
    (status, uid) = READER.MFRC522_Anticoll()
    if status != READER.MI_OK:
        print('1')
        continue
    print('3', uid)