const int Injector_One_Sensor = 0; //Set sensor for injector one LED as DI on pin #0 const int Injector_Two_Sensor = 1; //Set sensor for injector two LED as DI on pin #1 const int Injector_Three_Sensor = 2; //Set sensor for injector three LED as DI on pin #2 const int Injector_Four_Sensor = 3; //Set sensor for injector four LED as DI on pin #3 const int Ignition_Coil_One_Sensor = 4; //Set sensor for ignition coil one LED as DI on pin #4 const int Ignition_Coil_Two_Sensor = 5; //Set sensor for ignition coil two LED as DI on pin #5 const int Ignition_Coil_Three_Sensor = 6; //Set sensor for ignition coil three LED as DI on pin #6 const int Ignition_Coil_Four_Sensor = 7; //Set sensor for ignition coil four LED as DI on pin #7 const int Injector_One_Solenoid = 8; //Set injector solenoid one LED as DO on pin #8 const int Injector_Two_Solenoid = 9; //Set injector solenoid two LED as DO on pin #9 const int Injector_Three_Solenoid = 10; //Set injector solenoid three LED as DO on pin #10 const int Injector_Four_Solenoid = 11; //Set injector solenoid four LED as DO on pin #11 const int Ignition_Coil_One = 12; //Set ignition coil one LED as DO on pin #12 const int Ignition_Coil_Two = 13; //Set ignition coil two LED as DO on pin #13 const int Ignition_Coil_Three = 14; //Set ignition coil three LED as DO on pin #14 const int Ignition_Coil_Four = 15; //Set ignition coil four LED as DO on pin #15 int Injector_One_Sensor_State; //Create an integer variable for logical state checking int Injector_Two_Sensor_State; //Create an integer variable for logical state checking int Injector_Three_Sensor_State; //Create an integer variable for logical state checking int Injector_Four_Sensor_State; //Create an integer variable for logical state checking int Ignition_Coil_One_Sensor_State; //Create an integer variable for logical state checking int Ignition_Coil_Two_Sensor_State; //Create an integer variable for logical state checking int Ignition_Coil_Three_Sensor_State; //Create an integer variable for logical state checking int Ignition_Coil_Four_Sensor_State; //Create an integer variable for logical state checking void setup() { pinMode(Injector_One_Sensor, INPUT); //Assign injector one sensor as an input pinMode(Injector_Two_Sensor, INPUT); //Assign injector two sensor as an input pinMode(Injector_Three_Sensor, INPUT); //Assign injector three sensor as an input pinMode(Injector_Four_Sensor, INPUT); //Assign injector four sensor as an input pinMode(Ignition_Coil_One_Sensor, INPUT); //Assign ignition coil one sensor as an input pinMode(Ignition_Coil_Two_Sensor, INPUT); //Assign ignition coil two sensor as an input pinMode(Ignition_Coil_Three_Sensor, INPUT); //Assign ignition coil three sensor as an input pinMode(Ignition_Coil_Four_Sensor, INPUT); //Assign ignition coil four sensor as an input pinMode(Injector_One_Solenoid, OUTPUT); //Assign injector one solenoid as an output pinMode(Injector_Two_Solenoid, OUTPUT); //Assign injector two solenoid as an output pinMode(Injector_Three_Solenoid, OUTPUT); //Assign injector three solenoid as an output pinMode(Injector_Four_Solenoid, OUTPUT); //Assign injector four solenoid as an output pinMode(Ignition_Coil_One, OUTPUT); //Assign ignition coil one as an output pinMode(Ignition_Coil_Two, OUTPUT); //Assign ignition coil two as an output pinMode(Ignition_Coil_Three, OUTPUT); //Assign ignition coil three as an output pinMode(Ignition_Coil_Four, OUTPUT); //Assign ignition coil four as an output } void loop() { Injector_One_Sensor_State = digitalRead(Injector_One_Sensor); //check the logical state of injector one sensor (either HIGH or LOW) if (Injector_One_Sensor_State == LOW) { //conditional statement for IF injector one sensor is logical LOW digitalWrite(Injector_One_Solenoid, HIGH); //Turn ON injector one solenoid LED (white) } else { //opposite conditional statement for IF injector one sensor is NOT logical HIGH digitalWrite(Injector_One_Solenoid, LOW); //Turn OFF injector one solenoid LED (white) } Injector_Two_Sensor_State = digitalRead(Injector_Two_Sensor); //check the logical state of injector two sensor (either HIGH or LOW) if (Injector_Two_Sensor_State == LOW) { //conditional statement for IF injector two sensor is logical LOW digitalWrite(Injector_Two_Solenoid, HIGH); //Turn ON injector two solenoid LED (white) } else { //opposite conditional statement for IF injector two sensor is NOT logical HIGH digitalWrite(Injector_Two_Solenoid, LOW); //Turn OFF injector two solenoid LED (white) } Injector_Three_Sensor_State = digitalRead(Injector_Three_Sensor); //check the logical state of injector three sensor (either HIGH or LOW) if (Injector_Three_Sensor_State == LOW) { //conditional statement for IF injector three sensor is logical LOW digitalWrite(Injector_Three_Solenoid, HIGH); //Turn ON injector three solenoid LED (white) } else { //opposite conditional statement for IF injector three sensor is NOT logical HIGH digitalWrite(Injector_Three_Solenoid, LOW); //Turn OFF injector three solenoid LED (white) } Injector_Four_Sensor_State = digitalRead(Injector_Four_Sensor); //check the logical state of injector four sensor (either HIGH or LOW) if (Injector_Four_Sensor_State == LOW) { //conditional statement for IF injector four sensor is logical LOW digitalWrite(Injector_Four_Solenoid, HIGH); //Turn ON injector four solenoid LED (white) } else { //opposite conditional statement for IF injector four sensor is NOT logical HIGH digitalWrite(Injector_Four_Solenoid, LOW); //Turn OFF injector four solenoid LED (white) } Ignition_Coil_One_Sensor_State = digitalRead(Ignition_Coil_One_Sensor); //check the logical state of ignition one sensor (either HIHG or LOW) if (Ignition_Coil_One_Sensor_State == LOW) { //conditional statement for IF ignition one sensor is logical LOW digitalWrite(Ignition_Coil_One, HIGH); //Turn ON ingnition one solenoid LED (red) } else { //opposite conditional statement for IF ignition one sensor is NOT logical HIGH digitalWrite(Ignition_Coil_One, LOW); //Turn OFF ingnition one solenoid LED (red) } Ignition_Coil_Two_Sensor_State = digitalRead(Ignition_Coil_Two_Sensor); //check the logical state of ignition two sensor (either HIHG or LOW) if (Ignition_Coil_Two_Sensor_State == LOW) { //conditional statement for IF ignition two sensor is logical LOW digitalWrite(Ignition_Coil_Two, HIGH); //Turn ON ingnition two solenoid LED (red) } else { //opposite conditional statement for IF ignition two sensor is NOT logical HIGH digitalWrite(Ignition_Coil_Two, LOW); //Turn OFF ingnition two solenoid LED (red) } Ignition_Coil_Three_Sensor_State = digitalRead(Ignition_Coil_Three_Sensor); //check the logical state of ignition three sensor (either HIHG or LOW) if (Ignition_Coil_Three_Sensor_State == LOW) { //conditional statement for IF ignition three sensor is logical LOW digitalWrite(Ignition_Coil_Three, HIGH); //Turn ON ingnition three solenoid LED (red) } else { //opposite conditional statement for IF ignition three sensor is NOT logical HIGH digitalWrite(Ignition_Coil_Three, LOW); //Turn OFF ingnition three solenoid LED (red) } Ignition_Coil_Four_Sensor_State = digitalRead(Ignition_Coil_Four_Sensor); //check the logical state of ignition four sensor (either HIHG or LOW) if (Ignition_Coil_Four_Sensor_State == LOW) { //conditional statement for IF ignition four sensor is logical LOW digitalWrite(Ignition_Coil_Four, HIGH); //Turn ON ingnition four solenoid LED (red) } else { //opposite conditional statement for IF ignition four sensor is NOT logical HIGH digitalWrite(Ignition_Coil_Four, LOW); //Turn OFF ingnition four solenoid LED (red) } }