include SPI. "h"
# include "RFID. H"
# include "Servo. H"
Servo myservo;
Extern uint8_t SmallFont [];
RFID RFID (10, 8);//D10 - connected to SDA, D8 - the RST D13 - connected to SCK D11 - connected MOSI D12 - connected to MISO RQ doesn't meet
Unsigned char serNum [5].
Void setup ()
{
Serial.begin(9600);//a serial port to read need to add the card number, and then manually write program
Myservo. Attach (9);//steering gear stitch a 9
Myservo. Write (0);//steering gear initialization 0 degrees
SPI. The begin ();
Rfid. The init ();
}
Void loop ()
{
Long randNumber=random (0, 20);
Unsigned char I, TMP.
Unsigned char status;
Unsigned char STR [MAX_LEN];
Unsigned char RC_size;
//to find card
Rfid. IsCard ();
//read the card number
If (rfid) readCardSerial ())
{
Serial. Print (" your card id is: ");
Serial. Print (rfid) serNum [0]).
Serial. Print (", ");
Serial. Print (rfid) serNum [1], BIN);
Serial. Print (", ");
Serial. Print (rfid) serNum [2], BIN);
Serial. Print (", ");
Serial. Print (rfid) serNum [2], BIN);
Serial. Print (", ");
Serial. Print (rfid) serNum [4], BIN);
Serial. Println (" ");
//here is to change card number area
If (rfid) serNum [0]==30 | | rfid. SerNum [0]==148 | | rfid. SerNum [0]==136 | | rfid. SerNum [0]==161 | | rfid. SerNum [0]==68) {//the first screening
for(int i=0; 100 I "; I++)
{
If (rfid) serNum [0]==30 | | rfid. SerNum [0]==117 | | rfid. SerNum [0]==155)//the name of the second selection, support one 1
{
Serial. Println (" Welcome the test 1 ");
Myservo. Write (180);
}
If (rfid) serNum [0]==148 | | rfid. SerNum [0]==68 | | rfid. SerNum [0]==161).//rfid serNum [0]==161 the zero id position, which is able to change
{
Serial. Println (" Welcome the test 2 ");
Myservo. Write (180);
}
If (rfid) serNum [0]==136)
{
Serial. Println (" Welcome test 3 ");
Myservo. Write (180);
}
}
Delay (1000);
Myservo. Write (0);
Serial. Println (" closed ");
}
}
if (! Rfid. ReadCardSerial ()) {
}
Rfid. The halt ();//sleep
}
CodePudding user response:
Oneself the top, please help small whiteCodePudding user response:
Are you using the header filein ChineseTo check the Chinese into English I look at your code is inside
CodePudding user response:
Include SPI. "h"? The include tag can only be # include