PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Devices
Sensor
RFID Serial
RFID Read.c
1
/*
2
RFID Read.c
3
4
Reads and displays RFID tag numbers.
5
6
Connect: Vcc to 5V, /ENABLE to P2, SOUT to (R = 2.2 k) to P1, GND to GND
7
8
http://www.parallax.com/product/28140
9
*/
10
11
#include "
simpletools.h
"
// Include simpletools
12
#include "
rfidser.h
"
// Include rfidser
13
14
int
rfidEn = 2;
// Reader /ENABLE pin to P2
15
int
rfidSout = 1;
// Reader SOUT pin to P1
16
17
rfidser *rfid;
// Set up device ID
18
19
int
main
()
// Main function
20
{
21
rfid =
rfid_open
(rfidSout, rfidEn);
// Open reader, start reading
22
23
while
(1)
// Main loop
24
{
25
char
*str =
rfid_get
(rfid, 1000);
// Wait up to 1 s for card
26
print
(
"id = %s.\n"
, str);
// Print ID.
27
}
28
}
rfid_get
char * rfid_get(rfidser *device, int timeoutms)
Get RFID code from serial buffer.
Definition:
rfidser.c:125
rfidser.h
Simplifies reading Parallax Serial RFID Card Reader.
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
rfid_open
rfidser * rfid_open(int soutPin, int enablePin)
Runs the RFID card reading process in another cog.
Definition:
rfidser.c:20
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17