i want to make a fuel price calculator [closed]

  arduino, arduino-c++, c++

I want to calculate the fuel price. When i enter value from keypad and multiply with
store value it gives wrong answer(x=8, keypad value=4 z=x*keypad value=53 it give
different value). i enter different value from keypad but it give the ans like 53,48,51,67,54 etc.i want to store the value of fuel in eeprom and multiply this value with the keypad which i enter.

void setup() {
  // put your setup code here, to run once:
  // set up the LCD's number of columns and rows:
  Serial.begin(9600);
  // EEPROM.write(Address,f);
  //  inputString.reserve(10);

  // Serial.print(Address);
  //Serial.print("");
  // Serial.println(f);

  lcd.begin(16, 2);

  Serial.begin(9600);
  // pinMode(a,OUTPUT);      

}
void loop() {
  // put your main code here, to run repeatedly:
  // lcd.setCursor(0,1);
  lcd.setCursor(1, 0);
  lcd.print("Fuel.value");
  lcd.setCursor(11, 0);
  lcd.print(f);

  char key = keypad.getKey();

  lcd.setCursor(0, 1);

  // delay(2000);

  if (key) {
    Serial.println(key);
    int ff = key;
    int a = ff * dd;
    lcd.print(ff);
    Serial.println(ff);
    digitalWrite(6, OUTPUT);
    delay(1000);
  }
  if (key == 'D') {
    Serial.println(key);
    digitalWrite(6, LOW);
    delay(1000);
  }
  if (key == 'C') {
    lcd.setCursor(0, 1);
    lcd.clear();

  }
}

Source: Windows Questions C++

LEAVE A COMMENT