// WVN005 TURNTABLE GATE SEQUENCER

// LOMOND CAMPBELL 2019

const int AbuttonPin = 8; // the number of the proximity switch pin

const int AledPin = 12; // the number of the LED pin

const int AgatePin = 4; // the number of the gate output pin

const int BbuttonPin = 7; // the number of the proximity switch pin

const int BledPin = 11; // the number of the LED pin

const int BgatePin = 3; // the number of the gate output pin

const int CbuttonPin = 6; // the number of the proximity switch pin

const int CledPin = 10; // the number of the LED pin

const int CgatePin = 2; // the number of the gate output pin

const int DbuttonPin = 5; // the number of the proximity switch pin

const int DledPin = 9; // the number of the LED pin

const int DgatePin = 13; // the number of the gate output pin

// variables will change:

int AbuttonState = 0; // variable for reading the proximity switch status

int BbuttonState = 0; // variable for reading the proximity switch status

int CbuttonState = 0; // variable for reading the proximity switch status

int DbuttonState = 0; // variable for reading the proximity switch status

void setup() {

// initialize the LED pin as an output:

pinMode(AledPin, OUTPUT);

// initialize the proximity switch pin as an input:

pinMode(AbuttonPin, INPUT);

// initialize the gate output pin as an output:

pinMode(AgatePin, OUTPUT);

// initialize the LED pin as an output:

pinMode(BledPin, OUTPUT);

// initialize the proximity switch pin as an input:

pinMode(BbuttonPin, INPUT);

// initialize the gate output pin as an output:

pinMode(BgatePin, OUTPUT);

// initialize the LED pin as an output:

pinMode(CledPin, OUTPUT);

// initialize the proximity switch pin as an input:

pinMode(CbuttonPin, INPUT);

// initialize the gate output pin as an output:

pinMode(CgatePin, OUTPUT);

// initialize the LED pin as an output:

pinMode(DledPin, OUTPUT);

// initialize the proximity switch pin as an input:

pinMode(DbuttonPin, INPUT);

// initialize the gate output pin as an output:

pinMode(DgatePin, OUTPUT);

}

void loop(){

// read the state of the proximity switch value:

AbuttonState = digitalRead(AbuttonPin);

// read the state of the proximity switch value:

BbuttonState = digitalRead(BbuttonPin);

// read the state of the proximity switch value:

CbuttonState = digitalRead(CbuttonPin);

// read the state of the proximity switch value:

DbuttonState = digitalRead(DbuttonPin);

// check if the proximity switch has closed.

// if it has, the buttonState is HIGH:

if (AbuttonState == HIGH) {

// turn LED on:

digitalWrite(AledPin, HIGH);

// send gate high:

digitalWrite(AgatePin, HIGH);

}

else {

// turn LED off:

digitalWrite(AledPin, LOW);

// send gate low:

digitalWrite(AgatePin, LOW);

}

// check if the proximity switch has closed.

// if it has, the buttonState is HIGH:

if (BbuttonState == HIGH) {

// turn LED on:

digitalWrite(BledPin, HIGH);

// send gate high:

digitalWrite(BgatePin, HIGH);

}

else {

// turn LED off:

digitalWrite(BledPin, LOW);

// send gate low:

digitalWrite(BgatePin, LOW);

}

// check if the proximity switch has closed.

// if it has, the buttonState is HIGH:

if (CbuttonState == HIGH) {

// turn LED on:

digitalWrite(CledPin, HIGH);

// send gate high:

digitalWrite(CgatePin, HIGH);

}

else {

// turn LED off:

digitalWrite(CledPin, LOW);

// send gate low:

digitalWrite(CgatePin, LOW);

}

// check if the proximity switch has closed.

// if it has, the buttonState is HIGH:

if (DbuttonState == HIGH) {

// turn LED on:

digitalWrite(DledPin, HIGH);

// send gate high

digitalWrite(DgatePin, HIGH);

}

else {

// turn LED off:

digitalWrite(DledPin, LOW);

// send gate low:

digitalWrite(DgatePin, LOW);

}

}