Great, you did fantastic job , especially using comments liberally.
There are no logical errors , it compiles and works!
Few minor things, suggestions if you will.
LED 13 in not a power indicator.
Some of the symbols could be more descriptive.
But that is up to you , I used SirenContactorPin11 as an example.
( Please ignore the SirenContactorPinSirenContactorPin11 my mouse went crazy !)
Add Serial and use it to track the code flow.
I have added #define DEBUG so you can emulate the inputs. If you want to use it you can add more.
As far as code logic , lets start with this
// if input 1 is high and input 2 is low then siren on wail
if ( (inputstate1 == HIGH) && (inputstate2 == LOW) ) {
If looks for AND and if it is false it will turn the siren off - you did not specify WHICH part of the AND will turn it off.
Assuming that the AND is correct logic , than you want to apply similar process as you did for the LED 13 flash.
But right now the siren is controlled using AND and !AND.
It is strictly not necessary to write
if(Input == HIGH) or Input == LOW
simple
if(Input)
or
if(!Input)
helps to eliminate errors likes if ( Input = HIGH)
[code][code]
const int powerled = 13;
// the number of the LED pin
// Variables will change :
int ledState = LOW; // ledState used to set the LED
unsigned long previousMillis = 0; // will store last time LED was updated
// constants won't change :
const long interval = 500; // interval at which to blink power led(milliseconds)
long sequenceDelay = 500;
long flashDelay = 6000;
boolean LEDSirenContactorPinSirenContactorPin11state = false; // the LED will turn ON in the first iteration
boolean LED10state = false; // need to seed the light to be OFF
long waitUntilSirenContactorPinSirenContactorPin11 = 0;
long waitUntil10 = sequenceDelay; // the seed will determine time
int inputstate1 = 0;
int inputstate2 = 0;
int inputstate3 = 0;
const byte SirenContactorPin11 = 11; // siren contactor on pin 11
#define DEBUG // emulating inputs
//#undef DEBUG // remove when working
void setup() {
pinMode (13, OUTPUT); // power on indicator on board
pinMode (12, OUTPUT); // rt-2 reset whi-ornge wire to rt-2
pinMode (SirenContactorPinSirenContactorPin11, OUTPUT); // siren contactor
pinMode (10, OUTPUT); // siren rotator
pinMode (9, OUTPUT); // cancel indicator
pinMode (5, INPUT); // 5 // blue wire rt-2
pinMode (6, INPUT_PULLUP); // 6 // white wire rt-2
pinMode (7, INPUT_PULLUP); // 7 // gry-white wire rt-2
}
void loop()
{
// blink the power LED.
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(powerled, ledState);
}
#ifdef DEBUG
// emulate inputs
inputstate1 = random(0, 1); //digitalRead(5);
inputstate2 = random(0, 1)); //digitalRead(6);
inputstate3 = random(0, 1); // digitalRead(7);
Serial.print("inputstate1 ");
Serial.print(inputstate1);
#else
// read the state of the rt2 inputs are listed as inputs 1,2,3:
inputstate1 = digitalRead(5);
inputstate2 = digitalRead(6);
inputstate3 = digitalRead(7);
#endif
//check if input is ative
// warning mode
// if input 1 is high and input 2 is low then siren on wail
if ( (inputstate1 == HIGH) && (inputstate2 == LOW) ) {
#ifdef DEBUG
Serial.println("Siren on " );
Serial.print("inputstate1 ");
Serial.print(inputstate1);
#endif
digitalWrite(12, HIGH);
digitalWrite(SirenContactorPin11, HIGH);
digitalWrite(10, HIGH);
}
else {
// siren off
#ifdef DEBUG
Serial.println("Siren off " );
Serial.print("inputstate1 ");
Serial.print(inputstate1);
#endif
digitalWrite(12, HIGH);
digitalWrite(SirenContactorPin11, LOW);
digitalWrite(10, LOW);
}
// all clear mode
// if input 2 & 3 is low then siren on steady
if (inputstate3 == LOW) {
digitalWrite(12, HIGH);
digitalWrite(SirenContactorPinSirenContactorPin11, HIGH);
digitalWrite(10, HIGH);
}
else {
// siren off
digitalWrite(12, HIGH);
digitalWrite(SirenContactorPinSirenContactorPin11, LOW);
digitalWrite(10, LOW);
}
// all clear mode
// if input 2 & 3 is low then siren on steady
if ( (inputstate1 == HIGH) && (inputstate2 == LOW) && (inputstate3 == LOW) ) {
digitalWrite(12, LOW);
digitalWrite(SirenContactorPin11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(100);
digitalWrite(12, HIGH);
digitalWrite(9, LOW);
delay(300);
digitalWrite(12, LOW);
digitalWrite(9, HIGH);
delay(500);
digitalWrite(12, HIGH);
digitalWrite(9, LOW);
digitalWrite(9, HIGH);
delay(100);
digitalWrite(12, HIGH);
digitalWrite(9, LOW);
delay(300);
digitalWrite(12, LOW);
digitalWrite(9, HIGH);
delay(500);
digitalWrite(12, HIGH);
digitalWrite(9, LOW);
delay(1000);
}
else {
// siren off
digitalWrite(12, HIGH);
digitalWrite(SirenContactorPin11, LOW);
digitalWrite(10, LOW);
}
}
[/code][/code]