Statcounter

Sunday, November 25, 2018

Cam signal simulator, Arduino Nano, 1999 JTEC







Getting the factory tach to work with an LS engine swap





Arduino IDE-



//Cam signal simulator




/*Goal is to provide a cam signal to a JTEC equipped 1999 Dodge Dakota to make the dash tach guage ​
 * work and make JETC think the engine is running. This JTEC seems to need a evenly spaced 8 pulse crank signal ​
 * and a cam signal that changes state every 180 degrees rotation of the cam. Also added a inverted cam signal output ​
 * which can be used in case there is a correlation issue with the JTEC. crank input D2, output on D6 and D12 */​
  int state=LOW;​
  int lastState=LOW;​
  int count=0;​
  ​
void setup() {​
  // put your setup code here, to run once:​
  ​
  pinMode(2, INPUT);​
  pinMode(13, OUTPUT);​
  pinMode(12, OUTPUT);​
  pinMode(6, OUTPUT);​
  state = digitalRead(2);​
  digitalWrite(13, HIGH);​
  digitalWrite(12, LOW);​
  digitalWrite(6, HIGH);​
}​
void loop() {​
  // put your main code here, to run repeatedly:​
  ​
  if (state == HIGH && lastState == LOW) {​
    count++;​
  }​
  if (count <= 7) digitalWrite(13,HIGH),digitalWrite(12,LOW),digitalWrite(6,HIGH);​
  if (count >= 8) digitalWrite(13,LOW),digitalWrite(12,HIGH),digitalWrite(6,LOW);​
  if (count >= 15) count=0;​
  lastState=state;​
  state=digitalRead(2);
 }