Here is my sketch and i am trying to read another button state from another button .
but I can't make it work . How will I add another button state reading to the sketch?
#include <SwitchManager.h>
SwitchManager modeSW; // create the object
const byte ModeSW = 2;//input from the Mode push button switch
const int playPin = 7;
const int nextPin = 8;
int resetPin = 3;
void setup ()
{
modeSW.begin (ModeSW, modeSwitchManager);
pinMode(playPin, OUTPUT);
pinMode(nextPin, OUTPUT);
pinMode(resetPin, INPUT);
}
void loop ()
{
modeSW.check();
}
// M O D E S W I T C H M A N A G E R
//****************************************************************
// function looks after the Mode switch functions
void modeSwitchManager (const byte newState, const unsigned long interval)
{
if (newState == HIGH) //in this case ignor a switch release
{
digitalWrite(playPin, LOW);
digitalWrite(nextPin, LOW);
return;
}
if (interval >=1000)
{
delay(3000);
int state = digitalRead(ModeSW);
if (state == LOW)
{
digitalWrite(playPin, HIGH);
delay(750);
digitalWrite(playPin, LOW);
delay(7500);
int resetState = digitalRead(resetPin);
if (resetState == HIGH)
{
digitalWrite(nextPin, HIGH);
delay(500);
digitalWrite(nextPin, LOW);
delay(1000);
digitalWrite(playPin, HIGH);
delay(500);
digitalWrite(playPin, LOW);
delay(2500);
}
}
return;
} } // END of modeSwitchManager()