const int ignitionGap = 3000;const byte pinInductor = 6;unsigned long ignitionDelay = 0;unsigned long stopTime = 0;unsigned long lastStopTime = 0;unsigned long startTime = 0;volatile byte sensor = 0;volatile unsigned long lastTime = 0;volatile unsigned long deltaTime = 100000;const byte tablesLength = 9;// RPM: 1500, 2000, 2500, 3000, 4000, 5000, 6000, 7000, 8000int tableRPMPoints[] = { 40000, 30000, 24000, 20000, 15000, 12000, 10000, 8571, 7500 };int tableIgnDelays[] = { 365, 355, 350, 345, 345, 335, 325, 315, 315 };void setup(){ pinMode(pinInductor, OUTPUT); attachInterrupt(0, OnSensor, RISING);}void OnSensor(){ deltaTime = micros() - lastTime; lastTime = micros(); sensor = 1;}void loop(){ if (sensor == 1) { sensor = 0; if (deltaTime > 0 && deltaTime < 1000000) { byte i = 0; while (i < tablesLength && tableRPMPoints[i] > deltaTime) { i++; } if (i >= tablesLength) i = tablesLength - 1; if (tableIgnDelays[i] == 0) tableIgnDelays[i] = 1; ignitionDelay = (unsigned long)(deltaTime * (((unsigned long)tableIgnDelays[i] * 1000) / 360)) / 1000; // ignitionDelay = (unsigned long)(deltaTime * (((unsigned long)tableIgnDelays[i] << 10) / 360)) >> 10; startTime = lastTime + ignitionDelay; lastStopTime = stopTime; stopTime = startTime + ignitionGap; } } unsigned long ct = micros(); if ((startTime < ct && stopTime > ct) || lastStopTime > ct) { digitalWrite(pinInductor, HIGH); } else { digitalWrite(pinInductor, LOW); }}
а какая мощность будет рассеиваться на VT3, VT4?