Hello
I need some help with my code for car diagnostic.
I need to count led fleshes (button Presses) like this .
For example : the Code Error 35 is . ...... .....*.
The time between fleshes of first number is 1 s and pause between first and second number is 2 s.
int inPin = 7; // the number of the input pin
int reading; // the current reading from the input pin
int previous = LOW; // the previous reading from the input pin
int countA=0; //
int countB=0;
long time = 0;
long debounce = 200;
void setup()
{
pinMode(inPin, INPUT);
}
void loop()
{
reading = digitalRead(inPin);
if (reading == HIGH && previous == LOW && millis() - time > debounce) {
//increment count
countB++;}
else{
countA++;
}
time = millis();
previous = reading;
if (countA == 3 && countB ==5)
{
//whatever you want to do over here
countA=countB=0; //reset count
}
}