Go Down

Topic: Record and read SD card counters (Read 316 times) previous topic - next topic

mgt



hello there is a projem,
I activate a relay with the button, and when I press the button again, I close the relay. I have a problem with the program I share, for example, if I open and close the relay 10 times, I guess I have to give it a value 21. I think the counter counts the button as on and off.

The second problem is that I want to set the power on and off 100 times, but if the electricity is disconnected at the 20th turn, it starts from the beginning when I switch it on again. I bought a micro sd cart module but I have not been able to customize the program, thanks in advance to friends who can help

knut_ny

?? ==>  for (int i = 21; i > tur_sayisi ; i++)

Quote
if (digitalRead (role) == LOW)
          {
            digitalWrite(role , HIGH);
          }
          else
          {
            digitalWrite(role , LOW);
          }
replace with   ==>  digitalWrite(role,!digitalRead (role)); // alternating
Ny

knut_ny

From the very  start; it  was not very clear what you want to obtain.
Tell HOW it should behave.. in details.
Ny

Go Up