PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Learn
Simple Libraries
Sensor
librfidser
librfidser.c
1
/*
2
librfidser.c
3
4
Test harness for rfidser library.
5
6
Enable -> P2
7
Sout -> P1
8
*/
9
10
#include "simpletools.h"
// Include simpletools
11
#include "rfidser.h"
// Include rfidser
12
13
int
rfidEn = 2;
// Reader /ENABLE pin
14
int
rfidSout = 1;
// Reader SOUT pin
15
16
rfidser *rfid;
// Set up device ID
17
18
int
main
()
// Main function
19
{
20
rfid = rfid_open(rfidSout, rfidEn);
// Open reader, start reading
21
22
while
(1)
// Main loop
23
{
24
char
*str = rfid_get(rfid, 1000);
// Wait up to 1 s for card
25
26
if
(!strcmp(str,
"timed out"
))
// Timed out?
27
print(
"No ID scanned.\n"
);
// display "No ID..."
28
else
if
(!strcmp(str,
"70006E0299"
))
// Round card ID match?
29
print(
"Round card.\n"
);
// diaplay "Round..."
30
else
if
(!strcmp(str,
"0200822A14"
))
// Rectangle card ID match?
31
print(
"Rectangle card.\n"
);
// diaplay "Rectangle..."
32
else
// No matches?
33
print(
"id = %s.\n"
, str);
// print ID.
34
}
35
}
36
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:09 for PropWare by
1.8.12