got a problem with my speedometer that my brother and i build.
some times when i start, the program doesn’t seems to start the lcd just goes blank. it has made this both in car and on the bench when we first wired it up.
it’s made of a decimilia card, a lcd display and a hall sender that response to a magnet.
here is the prg… help please…
#include <LiquidCrystal.h>
// LiquidCrystal display with:
// rs on pin 12
// rw on pin 11
// enable on pin 10
// d0, d1, d2, d3 on pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int inPin = 7; // choose the input pin (for a pushbutton)
int val = 0; // variable for reading the pin status
int preval = 0;
unsigned long hastighet = 0;
unsigned long time = 0;
unsigned long nytime = 0;
unsigned long varvtid;
void setup() {
pinMode(inPin, INPUT); // declare pushbutton as input
lcd.setCursor(3, 0);
lcd.print (“hey ho”);
lcd.setCursor (5, 1);
lcd.print(“let’s go”);
}
void loop(){
val = digitalRead(inPin); // read input value
if (val != preval) {
if (val == LOW) { // check if the input is low (button released)
//lcd.setCursor(0, 0);
//lcd.print(“high”); // turn LED OFF
lcd.clear();
preval = val;
nytime = millis();
varvtid = (nytime - time);
time = nytime;
lcd.setCursor(0, 1);
lcd.print(60000/varvtid);
lcd.setCursor(4, 1);
lcd.print(“rpm pa utg”);
hastighet = (((60000/varvtid)/3.250.20.6));
lcd.setCursor(0, 0);
lcd.print(hastighet );
lcd.setCursor(10, 0);
lcd.print(“km/h”);
} else {
//lcd.clear();
//lcd.setCursor(0, 0);
//lcd.print(“low”); // turn LED ON
preval = val;
}
}
}