Pages: [1]   Go Down
Author Topic: very simple but don't know how to do it  (Read 585 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Dear friends,
working on RFID module MFRC522, and written an application to drive a DC motor as follow

 if(mfrc522.uid.uidByte[0] == 114){  //"114" is the first part of the 5 sets of digits from the card
                          Serial.println();
                          Serial.println("hey Lalit!");
                          digitalWrite(ledPin1, HIGH); //turns on green "access granted" LED
                          delay(1000);
                          digitalWrite(ledPin1, LOW);
                        }

In the above code, when my RFID Card having a value 114 gets read by the Reader then "hey Lalit" message get printed on Serial monitor screen and ledPin1 (which is pin number 3 on arduino board with Red LED) gets HIGH for 1 second, code is OK and working fine.
OK ..... now I want a Green LED on pin number 4, lets denote it as ledPin2 and code should work as follow
1) Reader reads card first time, Red LED becomes high for 1 second.
2) Reader reads same card second time, now Green Led should high for 1 second.
3) Reader reads same card third time, now again Red LED should high for 1 second.
.
.and same cycle should continue till Reader read the same card.
thanks, any help will be highly appreciated.
Logged

Ohio, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What does your whole sketch look like if you don't mind me asking?

also just for readability it's better to post code in [ code] [ /code] blocks.

Hope I can help you out with this =)
Logged

Pages: [1]   Go Up
Jump to: