Hi everyone,
I've been trying to send tag numbers of 3 digits from bluetooth HC-05 and store it into an array of integers x[n] so that i can create a sort of tag numbers database sent over bluetooth on arduino .
But n doesn't increment and it stucks on 0 and thus i can't give access to more than one tag via bluetooth !!
Please Help !!!!!!!
here is the code so far :
void loop() {
uchar i, tmp, checksum1;
uchar status;
uchar str[MAX_LEN];
uchar RC_size;
uchar blockAddr; //Selection operation block address 0 to 63
String mynum = "";
str[1] = 0x4400;
//Find tags, return tag type
status = myRFID.AddicoreRFID_Request(PICC_REQIDL, str);
if (status == MI_OK)
{
Serial.println("RFID tag detected");
Serial.print(str[0],BIN);
Serial.print(" , ");
Serial.print(str[1],BIN);
Serial.println(" ");
}
//Anti-collision, return tag serial number 4 bytes
status = myRFID.AddicoreRFID_Anticoll(str);
if (status == MI_OK)
{
checksum1 = str[0] ^ str[1] ^ str[2] ^ str[3];
Serial.println("The tag's number is : ");
//Serial.print(2);
Serial.print(str[0]);
Serial.print(" , ");
Serial.print(str[1],BIN);
Serial.print(" , ");
Serial.print(str[2],BIN);
Serial.print(" , ");
Serial.print(str[3],BIN);
Serial.print(" , ");
Serial.print(str[4],BIN);
Serial.print(" , ");
Serial.println(checksum1,BIN);
// put your main code here, to run repeatedly:
while (Genotronex.available() >2){
int n;
for (n =0; n<10 ; n++){
int i;
for(i = 0 ; i < 3; i++){ BluetoothData = Genotronex.read();
- // if number 1 pressed ....*
_ y = BluetoothData - '0';_
_ x[n] = y[0]*100+y[1]*10+y[2]*1;_
}}}
delay(100);// prepare for next data ...
* // Should really check all pairs, but for now we'll just use the first*
* if(str[0] == x[n]) //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor*
* {*
* Serial.print("Helllo World!\n");*
* Serial.print(n);*
* }*
* Serial.println();*
* delay(1000);*
* }*
* myRFID.AddicoreRFID_Halt(); //Command tag i*
}