//needed variables for Basic Button
int readVal;
int readVal2;
int count;
//needed variables for Resistor Button
int readVal_resistor;
int readVal_resistor2;
int count_resistor;
void setup()
{
Serial.begin(9600);
pinMode(7, INPUT);
//pinMode(7, INPUT);
//For Button with Resistors
//pinMode(A1, INPUT);
//pinMode(A4, INPUT);
}
void loop()
{
//basic();
//counter();
//Buttons using resitor
//basic_resistor(A1, LOW);
//basic_resistor(A4, HIGH);
//counter_resistor(A1, LOW, 150);
//counter_resistor(A4, HIGH, 150);
}
void basic(){
int readVal = digitalRead(7);
if (readVal == HIGH)
{
Serial.println("Pressed!");
}
else
{
Serial.println("Released!");
}
//delay(50);
}
void counter() {
int readVal2 = digitalRead(7);
if (readVal2 == LOW)
{
count++;
Serial.print("Counting: ");
Serial.println(count);
}
delay(50);
}
void basic_resistor(int btnPin, bool state){
int readVal_resistor = digitalRead(btnPin);
if (readVal_resistor == state)
{
Serial.println("Pressed!");
}
else
{
Serial.println("Released!");
}
//delay(50);
}
void counter_resistor(int btnPin, bool state, int wait) {
int readVal_resistor2 = digitalRead(btnPin);
if (readVal_resistor2 == state)
{
count_resistor++;
Serial.print("Counting: ");
Serial.println(count_resistor);
}
delay(wait);
}