本文介绍了如何使用arduino在vi-85f rfid阅读器中识别uhf rfid标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include "Arduino.h"
#include<SoftwareSerial.h>
SoftwareSerial mySerial (17,16);
unsigned char incomingByte;

void sendIdentifyCmd ()
{
  mySerial.write (0x40);    
  mySerial.write (0x04);
  mySerial.write (0x01);  
  mySerial.write (0x01);
  mySerial.write (0xCD);
  //mySerial.write (0x32);                
#ifdef DEBUG
  Serial.print (0x40);
  Serial.print (0x04);
  Serial.print (0x01);
  Serial.print (0x01);
  Serial.print (0xCD);
  //Serial.print (0x32);
  Serial.println ();
#endif
}

void setup ()
{
  Serial.begin (9600);
  mySerial.begin (9600);
  Serial.println ("begin initial Serial!\n");
}

void loop ()
{
  sendIdentifyCmd ();
  delay (2);
  while(mySerial.available ()<64)
  {
      incomingByte=mySerial.read();
      Serial.println(incomingByte,HEX);
      Serial.print (' ');
    Serial.println("no tag");
      delay(1000);
  }
  Serial.println ();
  delay (1000);
}













这是我的代码..请帮助我







this is my code..pls help me

推荐答案

#include "Arduino.h"

unsigned char incomingByte;
 
void sendIdentifyCmd ()
{
	Serial2.write (0x40);		
	Serial2.write (0x04);
	Serial2.write (0x01);	
	Serial2.write (0x01);
	Serial2.write (0xCD);
}
 
void setup ()
{
	Serial.begin (9600);
	while(Serial);
	Serial2.begin (9600);
	while(Serial2);
	
	Serial.println ("begin initial Serial!\n");
}
 
void loop ()
{
	sendIdentifyCmd ();
	
	delay (2);
	
	while(Serial2.available() < 64)
	{
		incomingByte = Serial2.read();
		
		Serial.println(incomingByte,HEX);
		delay(1000);
	}
	
	Serial.println ();
	delay (1000);
}


这篇关于如何使用arduino在vi-85f rfid阅读器中识别uhf rfid标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 18:21