Hey Guys,
I have hooked up a long range RFID reader to my arduino mega.
ground to ground
TX to RX
RX to TX
I am having problems with the code to make the reader scan and show the serial number of the scan tag. I want to show the serial number in the serial monitor of the arduino environment.
Any help would be greatly appreciated.
I am really not that good at coding, so please dont be mean! haha
Thanks,
Brandon
I feel like I need to make some pin to initiate the rfid reader to scan.
void setup()
{
for(int pinnumber = 0; pinnumber < 6; pinnumber++)
{
//Pin 0-5 set to input
pinMode(pinnumber, INPUT);q
}
for(int x = 6; x <= 12 && x > 5;
x++)
{
//Pin 6-12 set to output
pinMode(x, OUTPUT);
}
}
void loop()
{
int one = 0;
int two = 0;
int three = 0;
int four = 0;
int five = 0;
int mainswitch = 0;
int switch2 = 0;
int switch3 = 0;
int switch4 = 0;
int switch5 = 0;
int key_present = 0;
int two_present = 0;
int three_present = 0;
int four_present = 0;
int five_present = 0;
if(mainswitch == 1 && key_present)
{
//Checks for tag 2 and whether the switch is on
if(switch2 == 0 || two_present)
{
//cout>>“Green Light”;
}
else
{
two = 1;
}
//Checks for tag 3 and whether the switch is on
if(switch3 == 0 || three_present)
{
//cout>>“Green Light”;
}
else
{
three = 1;
}
//Checks for tag 4 and whether the switch is on
if(switch4 == 0 || four_present)
{
//cout>>“Green Light”;
}
else
{
four = 1;
}
//Checks for tag 5 and whether the switch is on
if(switch5 == 0 || five_present)
{
//cout>>“Green Light”;
}
else
{
five = 1;
}
}
// 375*1/75 = 5 seconds
for(int y = 0; y < 375; y++)
{
if (two = 1)
{
digitalWrite(2, HIGH); // sets the LED on
}
if(three = 1)
{
digitalWrite(3, HIGH); // sets the LED on
}
if(four = 1)
{
digitalWrite(4, HIGH); // sets the LED on
}
if(five = 1)
{
digitalWrite(5, HIGH); // sets the LED on
}
// 1/75 of a second, the critical rate at which people can
// see flashing
delay(13);
}
if (two = 1)
{
digitalWrite(2, LOW); // sets the LED on
two = 0;
}
if(three = 1)
{
digitalWrite(3, LOW); // sets the LED on
three = 0;
}
if(four = 1)
{
digitalWrite(4, LOW); // sets the LED on
four = 0;
}
if(five = 1)
{
digitalWrite(5, LOW); // sets the LED on
five = 0;
}
// 1/75 of a second, the critical rate at which people can
// see flashing
delay(13);
}