Arduino button and lcd

hi everyone i am making solar charger circuit in this site Solar Panel Battery Charge Controller Using Arduino in the code solar data is printed to serial but i need to change that with three button to show in lcd
for example if i press button1 it will display the Vin and if i press the button2 it will show the Vbat how can i modify the code to accomplish this , i am open to all suggestions if anyone can help me i would be very apreciated.

Best Regards…

Code
This also has the ability to monitor system
settings through the serial port.

*/

#define Vin 0 // AD0
#define Vbat 1 // AD1

#define Ioutput 2 // AD2 read ACS712 current

#define LED1 12 // red low Vin
#define LED2 10 // green charged
#define ChargeON 11 // charge current on
#define POWenable 3

// for use with PWM DP3
#define FULL 255
#define HALF 128
#define QUARTER 64
#define OFF 0

int x;
int y;

// these two variables can be changes
// for differing on/off times.
int chon = 5000; // charge on time
int choff = 2000; // charge off time

int CP = 310; // charge point variable
// CP sets the battery charge voltage level. Can vary from 300-340.
void setup() {

pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(ChargeON, OUTPUT);
pinMode(POWenable, OUTPUT);

digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(ChargeON, HIGH);
digitalWrite(POWenable, LOW);

Serial.begin(9600);

delay(500);

}

void loop() {

Serial.print("CP = ");
Serial.println(CP);

x = analogRead(Vin);
// voltage from solar panel
//under CP on ADC indicates not
// enough voltage to charge battery
// ~ 0.041 is derived from reading the
// voltage with a DVM
// the dividing by the returned
// int value.
Serial.print(x);
Serial.print(" ");
Serial.print("Vin = ");
Serial.println(x * .041);

y = analogRead(Vbat);
// voltage on battery to be charged
// over or equal to CP on ADC indicates
// fully charged battery
Serial.print(y);
Serial.print(" ");
Serial.print("Vbat = ");
Serial.println(y * .041);

// red LED
if (x < CP) digitalWrite(LED1, LOW);
else digitalWrite(LED1, HIGH);
// LED on indicates low or no input voltage

// green LED
if (y > CP) digitalWrite(LED2, LOW);
else if (y <= CP) digitalWrite(LED2, HIGH);
// LED on means battery is charged

if ((x > y) && (y <= CP) && (x > CP)) {
// check input voltage and voltage on battery
// turn on charge cycle if voltage input
// good AND battery voltage low.

if (y <= CP) { // turn on voltage to battery
// uncomment below will shorton ON time as charge
// nears completion.
// chon = (CP - y) * 100;

// turn on charge LED
digitalWrite(ChargeON, LOW);

// charge switching transistor
// can be pulse-width modulated
// four values are OFF, QUARTER, HALF, FULL
// This uses DP3.
analogWrite(POWenable, FULL);

// print chon value
Serial.print("chon = “);
Serial.print(chon);
Serial.print(” ");

delay(2000);

// this section read a Hall effect current sensor
// if attached. It read about 510 with no current flow
// 1 amp causes a change of 40 or .2v as measured
// with a DVM. Thus .2 / 40 = .025
// This can be used to display charge current.
// float temp = (analogRead(Ioutput) - 510) * .025;
// This could tested for heavy charge current from
// a nearly dead battery which can be limited to
// a safe value by cutting the duty cycle back
// POWenable to QUARTER or HALF.
int temp = analogRead(Ioutput);
Serial.print(temp);
Serial.print(" I out = “);
Serial.print((temp - 506) * .0283);
Serial.println(” amps. ");

delay(chon); // ON wait
digitalWrite(ChargeON, HIGH); // Charge LED off
analogWrite(POWenable, OFF); // turn off MOSFET
}

} // end if

// turn off charge enable
delay(choff); // OFF wait
}

couple mistakes. first you did not read 'how to use this forum' if you did, you would have used code tags. some people will not respond unless the code is in code tags.

second, you posted on the 'project guidance' forum this is for general guidance and feasibility.

in keeping with the decorum of this forum, your concept is feasible. go to the software forum to discuss software issues.

and remember to use code tags.

Hi.
Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Tom… :slight_smile: