Hot answers tagged

2

I would use a programming concept called a state machine. For example an integer variable called State could be used to track the current status which could for example be WAITING_FOR_DATA or RECEIVING_DATA or DATA_COMPLETE and only print when DATA_COMPLETE. I'm sure there are plenty of examples you could find with an appropriate search.


2

Add int passCount = '0'; to the top of your file and then increment that value by one every time the wrong password gets entered (For example replace Reset = 1; with passCount ++; on line 199) And add passCount = '0' to your reset on line 85. And add another if statement to reset loop if password has been entered more than 3 times. if (passCount == 3) {...


2

Your code loops from the high order byte to the low order byte, printing each byte as 2 hex digits. If you want instead to print the first byte as a decimal value, and then the remaining bytes as another decimal value, then do this: Print byte 0 in base 10: Serial.print(data[0]); //first byte Serial.print(":"); Then loop through the remaining ...


1

As you might have already seen, a position sensing system can be really complex. Here I will list some possibilities, that come to my mind and might be fitting for your case or not. Matrix based solutions: Here I mean sensors a some sort arranged in a matrix underneath the game table, which can sense the object placed on them. As you know from your wiring, ...


1

That's because you can only listen at one SoftwareSerial interface at a time. On the other interface you will receive nothing. The SoftwareSerial library uses interrupts to watch at the pins. These interrupts cannot easily be shared between different interfaces, thus the SoftwareSerial library doesn't support it. You can do 2 things: You could ditch the ...


1

The accepted way to initialize an array in C follows this example: const char ID [] = {111, 11, 11, 11}; You can read more about it here. You later use an array name ("ID") with no index ("ID[0]"). The C compiler assumes the programmer who uses an array name with no index is interested in the memory address of the first element of the array. But you ...


1

Assuming you have an RFID scanner that you can interface with the Arduino, sure. The Arduino is a modest 8-bit processor running at 8 or 16 mHz, with pretty limited memory. You program it in C/C++. What you describe is dirt-simple, and well within the abilities of an Arduino, so yes.


1

There is no real multitask on Arduinos. The Arduino can only do one thing at a time. But, you can do things sequentially, one after another, so fast, that a human will think, that it happens simultaneously. This involves a non-blocking coding style, which needs no interrupts Every delay in your code (at least the long onces) need to be removed. if you want ...


1

You do not necessarily need a build a "multitask with interrupts on Arduino". Instead consider using a state machine. First define the problem by drawing a state diagram: Consider all state you wish to be in. Including your example "...after one card is scanned, 1st relay with the flow sensor has to be turned on and simultaneously the scanning of the ...


1

Your code written more complex, than it has to be, and you have much repeated code, that makes it harder to understand and change the code. So I will first describe, how to shorten and generalize your code. That will make it easier to implement new features, like invalidating a card after 3 wrong PIN entries. Handling the RFID cards: Currently you are using ...


1

1.initialize a global variable int failcount=0,MiFareCardMode=0; for reset put it in an if statement that checks fail count if(failcount==0) {reset code}``` in this piece of code increase the failcount number(line 195:200) also add an if statement to check which card was detected initialize a global variable to set the card status ...


1

1.prefer using Serial.readStringUntil(); OR Serial.readString() that way its much easy to manipulate. 2.use a static variable in loop function which stores the string or use a global variable to save char array tagString1 before going in println function same goes with the second reader that way the println will show the previous scan until a new scan is ...


1

There is missing information. Assuming a 5V Arduino and all D0s and D1s swing from 5V to 0V as the Wiegand protocol defines. This despite the 12V power supply in the question's diagram. Examining the driver code on GitHub, we see it's falling edge interrupt driven. So any noise when the line is expected to be at a steady 5V will cause the driver to run. ...


Only top voted, non community-wiki answers of a minimum length are eligible