/*
  Simplified Pseudocode:
  1. Initialize pins for the two injector banks.
  2. Use a timer to generate 5 ms pulses for each injector bank.
  3. Alternate between the two banks every 75 ms.
*/
unsigned long timeout75 = 75; // 75ms timeout
unsigned long timeout5 = 5; // 5ms timeout // will be 1/15 of
unsigned long timer75; // "75 ms" timer
unsigned long timer5;  // "5 ms" timer
bool bank = 1; // alternate banks, start with 1 to be negated on first loop()
byte injectorPinStart = 5;
byte bankApin = 5; // A injectors
byte bankBpin = 6; // B injectors
int speed = 1; // 1 = normal speed (no printing), 10 = 1/10 speed // 100 is v e r y s l o w
volatile bool buttonPressed; // variable INSIDE interrupt service routeine
int buttonPin = 2; // interrupt pin INT0
void setup() {
//  timeout75 *=  speed; // speed multiplier (to slow the timing for simulation)
 // timeout5 *= speed; // speed multiplier (to slow the timing for simulation)
  Serial.begin(115200);
  pinMode(bankApin, OUTPUT); // configure pins
  pinMode(bankBpin, OUTPUT);
  digitalWrite(bankApin, LOW); // set pins LOW
  digitalWrite(bankBpin, LOW);
  pinMode(buttonPin, INPUT_PULLUP); // timing sensor
}
unsigned long now;
void loop() {
  now = millis();
// adjust RPM (was "speed")
  timeout75 = map(analogRead(A0), 0, 1024, 30, 750);
  timeout5 = timeout75 / 15.0;
  if (now - timer75 > timeout75) { // every 75 milliseconds
    timer75 = now; // reset 75ms timer
    bank = !bank; // switch bank
    fire(bank); // fire bank
  }
  serviceBank();
}
// this will one day just start the bank
void fire(byte bank) {
  digitalWrite(bank + injectorPinStart, HIGH); // bankA START firing
  timer5 = now;
}
// this will one day advance the current bank 
void serviceBank()
{
  if (now - timer5 > timeout5) { // wait for 5ms
    timer5 = now; // reset 5ms timer
    digitalWrite(bank + injectorPinStart, LOW); // bankA STOP firing
  }
}
/*
  if (speed != 1) { // if speed is NOT 1 (full speed)
    Serial.write(bank + 65); // bank + ASCII 'A' = A or B
    Serial.print(1); // Show injectors ON
  }
  
    if (speed != 1)
      Serial.print(0); // Show injectors OFF
*/
int buttonISR() { // Interrupt Service Routine called on a button press
  noInterrupts(); // disable interrupts while in the ISR
  buttonPressed = true; // set the flag that the button was pressed
  interrupts(); // enable interrupts when leaving the ISR
}2T
58T
A
B