本帖最后由 cnkids 于 2012-8-1 21:30 编辑
char Str1[4];
int i=0;
const int ENPin = 2; // the number of the EN pin
int ENState = 1; //default EN state was HIGH
unsigned char ID[4] = {0x00,0x17,0x3E,0x41};
int val = 0;
int status = 0;
void setup()
{
Serial.begin(9600);
pinMode(ENPin, INPUT);
}
void loop()
{
// read the state of the EN value:
ENState = digitalRead(ENPin);
// check if the EN is LOW,the output the data.
while(ENState == LOW&&Serial.available() > 0)
{
// read the incoming byte:
Str1 = Serial.read();
if(i>=3)
{
i=0;
Serial.println(" ");
}
else
{
Serial.print(Str1, HEX);
i++;
}
}
i=0;
}
用的是thomas的程序,改了一些..是在不知道卡号匹配比较从哪加进去。。。求高手~ |