need lots of help with lcd and menu

ok i know this is a ridiculous code but im learning. basically i have a project im building for a turbo charged car. this product needs to be efficient in order to keep the car from blowing up :~

#include <Servo.h>
#include <LiquidCrystal.h>

//pins for lcd screen
LiquidCrystal lcd(12, 11, 5, 4, 3, 15);

//attaching the servo
Servo WG;

//pressure sensor attach
int PsiPin = A0;   
int PsiValue = 0; 
int buttonPin = 13;
int button2Pin = 10;
int buttonState = 0; 
int button2State = 0; 

void setup() 
{ 
  lcd.begin(16, 2);
  
  lcd.print("-+-+-Xience-+-+-");
  pinMode(6, OUTPUT);
  delay(2500);
  lcd.clear();
  pinMode(6,INPUT);
  lcd.print("StAtUs");
  WG.attach(9, 100, 1200);
 pinMode(button2Pin, INPUT);
 pinMode(buttonPin, INPUT); 
}
void loop()
{
  lcd.setCursor(0, 1);
  button2State = digitalRead(button2Pin);
  PsiValue=analogRead(PsiPin);
   if (PsiValue < 345 || PsiValue == 345)
 {
   WG.writeMicroseconds(100);
  pinMode(7, OUTPUT);
  pinMode(8, INPUT);
  pinMode(6, INPUT);
lcd. print("NO PRESSURE-----");
 }
}

so the code has no menu right now but heres a few problems im having
as the boost pressure rises the numbers that match the value are rising so fast i can barley read them…
and the servo is so jittery becasue the value that it moves at is so small, how can i make it so its within a certain range of values?

also i need a menu so that i can make adjustments to values in the code by the two push buttons on my enclosure.
any help is very appreciated! :grin:

  pinMode(6, OUTPUT);

I’d really recommend using variables, with meaningful names, for the pin numbers. Pin 6 doesn’t tell us what is attached to that pin.

   if (PsiValue < 345 || PsiValue == 345)

would be simpler to understand as:

if(PsiValue <= 345)
  pinMode(6, OUTPUT);
  pinMode(6,INPUT);
  pinMode(6, INPUT);

Give us a clue. What the hell do you have attached to pin 6? You never read from the pin or write to the pin. You just keep jerking it around. What is going on?

basically i have a project im building for a turbo charged car. this product needs to be efficient in order to keep the car from blowing up

Please don’t. You are nowhere near ready to have the Arduino controlling a turbo charger.

pin 6-8 is a rgb led used for pressure warnings.

Ive already tested the prototype and it works. it just needs some bugs fixed... i dont need people to tell me i cant do it i need people to help teach me how to write code better.

pin 6-8 is a rgb led used for pressure warnings.

Then why are you changing the pinMode back and forth from input to output etc.? Take a look at the 'blink' example if you want to learn how to turn an LED on and off.

Don

I think because you're displaying info so frequently, you make the numbers change too fast, thus slowing down everything else, ie. the servo.

For menu, why not check out my latest invention, the phi-menu? It does everything you wanted for changing parameters.

http://liudr.wordpress.com/2011/03/17/phi-menu-is-about-to-be-released/

I also have large fonts on the display if you want a speedometer that displays large numbers:

http://liudr.wordpress.com/2011/03/21/big-font/

Xone,

LCD-routines are extremely slow for this application, engine needs much more attention all the time that is available. You should consider 7-segment displays, they are fast to refresh.

Cheers, Kari