4

The problem is that you add 15, and than if it's >= 240, you decrease 15, so it will not change (I wouldn't consider it haywire though). You can better use a direction sign. Below is only the relevant code (not the GPIO functionality). What it does in the loop is, in case up is true, it adds fifteen, otherwise it subtracts 15. When 255 is reached, it ...


2

Include Guards only protect against inclusion of a header file multiple times within the same translation unit. This is important. If you include a header file (1) in a source file, then include another header file (2) in the same source file, said header file also including the previous header file (1), then the include guard will perform its function. ...


2

The IO doesn't require the clock to keep its current state. It only requires it to change state. There is no real external signal provided by the chip to indicate if its in sleep mode or not. However you could monitor the current consumption of the chip and when it drops below a certain threshold you can assume that it is in sleep mode.


1

You define i,y,i as global variables so there is no need to hand them over to different functions. They can be accessed and changed in all parts of your program. define instead of int y; change to long y; and change void inOut(int &i){ to void inOut(){ and remove return i;// Its a global var change the line unsigned long y = ((...


1

Doing something as complex as a HTTP request in an interrupt is a very very silly idea. Instead set a flag in the interrupt routine and examine that in the main loop() function to perform your HTTP request.


1

void loop() { digitalWrite(redPin, HIGH); delay(250); digitalWrite(redPin, LOW); delay(250); } I'm not quite sure what you're after but this is shorter and would get you equivalent results. Since loop is going to repeat anyway, there's no need to repeat yourself inside loop. Per the comments, not that this is particularly useful... const int ...


1

The if condition is causing the issue. When the global variable 'fade' reaches 240, upon entering the loop(), you are incrementing it by 15, making 'fade' = 245. So, the if condition becomes true and 15 is subtracted from 245 making 'fade' to be equal to 240 again. This keeps repeating and hence the value 'fade' variable is stuck between the values 240 and ...


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 ...


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