RFID with pressure sensor

Hi, I just want to ask why doesn’t my value become zero when i put value==0?

Here is the codes with RFID and speaker and LED.

// Example sketch to read the ID from an Addicore 13.56MHz RFID tag
// as found in the RFID AddiKit found at:
// http://www.addicore.com/RFID-AddiKit-with-RC522-MIFARE-Module-RFID-Cards-p/126.htm

#include <AddicoreRFID.h>
#include <SPI.h>

#define uchar unsigned char
#define uint unsigned int

//4 bytes tag serial number, the first 5 bytes for the checksum byte
uchar serNumA[5];

uchar fifobytes;
uchar fifoValue;

AddicoreRFID myRFID; // create AddicoreRFID object to control the RFID module

/////////////////////////////////////////////////////////////////////
//set the pins
/////////////////////////////////////////////////////////////////////
const int chipSelectPin = 10; //SDA pins
const int NRSTPD = 5; //reset pin
int sensePin=2; //the pin the FSR is attached to
int ledPin=9; // the pin the LED is attached to (use one capable of PWM)
int speaker=8;
int LEDbrightness;

//Maximum length of the array
#define MAX_LEN 16

void setup() {
Serial.begin(9600); // RFID reader SOUT pin connected to Serial RX pin at 9600bps
pinMode(speaker, OUTPUT); //declare the speaker as an OUTPUT
pinMode(ledPin, OUTPUT); //declare the ledPin as an OUTPUT

// start the SPI library:
SPI.begin();
pinMode(chipSelectPin,OUTPUT); // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin
digitalWrite(chipSelectPin, LOW); // Activate the RFID reader
pinMode(NRSTPD,OUTPUT); // Set digital pin 10 , Not Reset and Power-down
digitalWrite(NRSTPD, HIGH);

myRFID.AddicoreRFID_Init();

}
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);
int value=analogRead(sensePin/4);
Serial.println(value);
int pitch=map(value,0,1023,225,255);
LEDbrightness=map(value,0,1023,0,255);
analogWrite(ledPin,value);
analogWrite(speaker,value);

if (status == 0||value==0)
{
digitalWrite(ledPin,HIGH);
noTone(8);
}
else 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);

// Should really check all pairs, but for now we’ll just use the first
if(str[0] == 94) //You can change this to the first byte of your tag by finding the card’s ID through the Serial Monitor
{
Serial.print(“Hello world!\n”);
} else if(str[0] == 100) { //You can change this to the first byte of your tag by finding the card’s ID through the Serial Monitor
Serial.print(“Hello User!\n”);
}
Serial.println();
delay(1000);
digitalWrite(ledPin,HIGH);
tone(8,pitch);

}

myRFID.AddicoreRFID_Halt(); //Command tag into hibernation

}

Here the link below is the serial monitor output:

Thank you! :slight_smile:

Hi, I just want to ask why doesn't my value become zero when i put value==0?

There is an = operator and an == operator. It is critically important to know the difference. See the reference page, if an "Oh, Duh!" moment doesn't occur.

yoyowadsup:
Hi, I just want to ask why doesn't my value become zero when i put value==0?

if x=5 means the value five assign to variable 'x' and next one is x==5 here it checking the value of x is equal to 5 or not,