Hi. I am new to Arduino. Not so new to electronics. I am owning an Automotive conversions workshop and constantly trying to modify things.
I am currently busy designing instrument cluster but struggle a bit with the speedometer and tachometer coding. the pulses are 5v Square wave pulses from a aftermarket engine management system. The pulses currently used for input into Arduino are 2 pulses per revolution for Tachometer and 12 pulses or the Speedometer. Both supplying ecu`s are fairly calibrate able and can pulse adjustments be done on ecu for finer tune.
Please can someone help met to rectify this starting code.
Thanx in advance.
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(2,3,4,5,6,7);
//declare variables
float tempC;
int tempPin = 0;
int speedinput=8;
int rpminput = 9;
int speedhigh_time;
int speedlow_time;
float speedtime_period;
float speedfrequency;
float rpmhigh_time;
float rpmlow_time;
float rpmtime_period;
float rpmfrequency;
void setup(){
// set up the LCD's number of columns and rows:
lcd.begin(20,4);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Water Temp");
lcd.setCursor (0,1);
lcd.print("SPEED");
}
void loop(){
tempC = analogRead(tempPin); //read the value from the sensor
tempC = (50tempC50 )/1024; //convert the analog data to temperature
// print result to lcd display
lcd.setCursor(11,0);
lcd.print(tempC);
lcd.print("'C");
// sleep...
delay(1000);
}
pulseIn (input==HIGH);
pulseIn (input==LOW);
time_period=high_time+low_time;
time_period=time_period/1000;
frequency=1000/time_period;
lcd.setCursor(6,1);
lcd.print("KM/H");
}.
rpmhigh_time=pulseIn(input,HIGH);
rpmlow_time=pulseIn(input,LOW);
time_period=high_time+low_time;
time_period=time_period/1000;
frequency=1000/time_period;
lcd.setCursor(0,2);
lcd.print(" RPM");
delay(500);
}