如何使用arduino在vi-85f rfid阅读器中识别uhf rfid标签? [英] how to identify uhf rfid tag in vi-85f rfid reader using arduino?

查看:130
本文介绍了如何使用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

推荐答案

目前尚不清楚你的问题是什么,以及你究竟是怎么回事连接到读者,但有一些事情你应该检查...



1.你是否越过了tx / rx线?你应该!

2. SoftwareSerial有哪些端口可用作rx的限制。点击此处: https://www.arduino.cc/en/Reference/SoftwareSerial [ ^ ],并考虑使用带有多个硬件序列的Arduino板(Mega) ?)。



// UPDATE

It is not clear what is your problem, and how exactly did you connected to the reader, but there are a few things you should check...

1. Did you crossed the tx/rx lines? You should!
2. SoftwareSerial has its limitation about what port can be used as rx. Check here: https://www.arduino.cc/en/Reference/SoftwareSerial[^], and consider to use an Arduino board with more than one hardware serial (Mega?).

// UPDATE
#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标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆