I am working on a petrol pump display, I have read the sticky on homework help and therefore understand and will appreciate all the help that is given to me.
Basically when the Nozzle button is pressed I want it to start dispencing the petrol so the litres dispensed will go up which is controlled by inserting pictures that are in the same directory. My code is below and runs but the numbers take 10 seconds to change to each one and I don't understand how to implement a interval and so it works on a button, with the timer disabled until pressed, I have many ways but they don't work.
procedure TfrmPetrolDisplay.Timer1Timer(Sender: TObject);
Var
LitresStr:String;
n1:char;
n2:char;
n3:char;
begin
Litres:=Litres+1;
LitresStr:=IntToStr(litres);
While Length(litresStr) <=3 do
LitresStr:='0'+LitresStr;
n1:=LitresStr[1];
n2:=LitresStr[2];
n3:=LitresStr[3];
Begin
Case n1 Of
'0':Img1.picture.loadfromfile('0.bmp');
'1':Img1.picture.loadfromfile('1.bmp');
'2':Img1.picture.loadfromfile('2.bmp');
'3':Img1.picture.loadfromfile('3.bmp');
'4':Img1.picture.loadfromfile('4.bmp');
'5':Img1.picture.loadfromfile('5.bmp');
'6':Img1.picture.loadfromfile('6.bmp');
'7':Img1.picture.loadfromfile('7.bmp');
'8':Img1.picture.loadfromfile('8.bmp');
'9':Img1.picture.loadfromfile('9.bmp');
End;
Begin
Case n2 Of
'0':Img2.picture.loadfromfile('0.bmp');
'1':Img2.picture.loadfromfile('1.bmp');
'2':Img2.picture.loadfromfile('2.bmp');
'3':Img2.picture.loadfromfile('3.bmp');
'4':Img2.picture.loadfromfile('4.bmp');
'5':Img2.picture.loadfromfile('5.bmp');
'6':Img2.picture.loadfromfile('6.bmp');
'7':Img2.picture.loadfromfile('7.bmp');
'8':Img2.picture.loadfromfile('8.bmp');
'9':Img2.picture.loadfromfile('9.bmp');
End;
Begin
Case n3 Of
'0':Img3.picture.loadfromfile('0.bmp');
'1':Img3.picture.loadfromfile('1.bmp');
'2':Img3.picture.loadfromfile('2.bmp');
'3':Img3.picture.loadfromfile('3.bmp');
'4':Img3.picture.loadfromfile('4.bmp');
'5':Img3.picture.loadfromfile('5.bmp');
'6':Img3.picture.loadfromfile('6.bmp');
'7':Img3.picture.loadfromfile('7.bmp');
'8':Img3.picture.loadfromfile('8.bmp');
'9':Img3.picture.loadfromfile('9.bmp');
End;
End;
End;
End;
End;
end.
Thanks, all help appreciated.