Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
bigboibobhacker
Published © CERN-OHL

Calculator

A cool calculator

IntermediateFull instructions provided103
Calculator

Things used in this project

Hardware components

Pushbutton Switch, Push On-Push Off
Pushbutton Switch, Push On-Push Off
any button works
×13
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Arduino UNO
Arduino UNO
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Calculator

refer to integer section in code for circuits

Code

Calculator code

Arduino
Connect buttons to pins 13-2 and A0. If you are confused look in the integer section of the code.
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

LiquidCrystal_I2C lcd (0x27, 16, 2);
long x;
long y;
long xy;
long x2;
long y2;
long xy2;
long x3;
long y3;
long xy3;
long x4;
long y4;
long xy4;
int butL = 13;
int but2 = 12;
int but3 = 11;
int but4 = 10;
int but5 = 9;
int but6 = 8;
int but7 = 7;
int but8 = 6;
int but9 = 5;
int but10 = 4;
int butR = 3;
int MButton = 2;
int time1;
int time2;
int time3;
int time4;
int count = 4;
int count2 = 4;
int count3 = 4;
int count4 = 4;

float pi = 3.14159265359;
float radius;
float area;
int count6 = 4;
int time6;

float width;
float area2;
int count7 = 4;
int time7;

float width2;
float length1;
float area3;
int count8;
int time8;

float width3;
float length2;
float height;
float volume;
int count9 = 4;
int time9;

float length3;
float SurfaceArea;
int count10 = 4;
int time10;

float decimalx;
float decimaly;
float decimalxy;
int count5 = 4;
int time5;

long number;
long exponent;
long equivalent;
int count11 = 4;
int time11;

long answer;
long xx;
long xxx;
long xxxx;
int count12 = 4;
int time12;


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  pinMode(butL, INPUT_PULLUP);
  pinMode(but2, INPUT_PULLUP);
  pinMode(but3, INPUT_PULLUP);
  pinMode(but4, INPUT_PULLUP);
  pinMode(but5, INPUT_PULLUP);
  pinMode(but6, INPUT_PULLUP);
  pinMode(but7, INPUT_PULLUP);
  pinMode(but8, INPUT_PULLUP);
  pinMode(but9, INPUT_PULLUP);
  pinMode(but10, INPUT_PULLUP);
  pinMode(butR, INPUT_PULLUP);
  pinMode(MButton, INPUT_PULLUP);
  pinMode(A0, INPUT_PULLUP);
}




void loop() {
  // put your main code here, to run repeatedly:
  if (digitalRead(A0) == 0) {
    count = 4;
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("addition");
    delay(600);

    for (time1 == 0; time1 < 150; time1++) {
      if (digitalRead(MButton) == 0) {
        count = 100;
      }
      else {
        delay(10);
      }
    }
    if (count == 100) {
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("confirmed");
      delay(750);
      lcd.clear();
      while (digitalRead(butR) == 1) {
        if (digitalRead(butL) == 0) {
          lcd.clear();
          x++;
          lcd.setCursor(0, 0);
          lcd.print(x);
          Serial.println(x);
          delay(355);
        }
        if (digitalRead(but2) == 0) {
          y++;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(y);
          Serial.println(y);
          delay(355);
        }
        if (digitalRead(but3) == 0) {
          x += 10;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(x);
          Serial.println(x);
          delay(355);
        }
        if (digitalRead(but4) == 0) {
          y += 10;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(y);
          Serial.println(y);
          delay(355);
        }
        if (digitalRead(but5) == 0) {
          x += 100;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(x);
          Serial.println(x);
          delay(355);
        }
        if (digitalRead(but6) == 0) {
          y += 100;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(y);
          Serial.println(y);
          delay(355);
        }
        if (digitalRead(but7) == 0) {
          x += 1000;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(x);
          Serial.println(x);
          delay(355);
        }
        if (digitalRead(but8) == 0) {
          y += 1000;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(y);
          Serial.println(y);
          delay(355);
        }
        if (digitalRead(but9) == 0) {
          x += 10000;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(x);
          Serial.println(x);
          delay(355);
        }
        if (digitalRead(but10) == 0) {
          y += 10000;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(y);
          Serial.println(y);
          delay(355);
        }
      }
      xy = x + y;
      Serial.println(xy);
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print(xy);
    }
    else {
      count2 = 4;
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("subtraction");
      delay(600);

      for (time2 == 0; time2 < 150; time2++) {
        if (digitalRead(MButton) == 0) {
          count2 = 100;
        }
        else {
          delay(10);
        }
      }
      if (count2 == 100) {
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("confirmed");
        delay(750);
        lcd.clear();
        while (digitalRead(butR) == 1) {
          if (digitalRead(butL) == 0) {
            lcd.clear();
            x2++;
            lcd.setCursor(0, 0);
            lcd.print(x2);
            Serial.println(x2);
            delay(355);
          }
          if (digitalRead(but2) == 0) {
            y2++;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(y2);
            Serial.println(y2);
            delay(355);
          }
          if (digitalRead(but3) == 0) {
            x2 += 10;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(x2);
            Serial.println(x2);
            delay(355);
          }
          if (digitalRead(but4) == 0) {
            y2 += 10;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(y2);
            Serial.println(y2);
            delay(355);
          }
          if (digitalRead(but5) == 0) {
            x2 += 100;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(x2);
            Serial.println(x2);
            delay(355);
          }
          if (digitalRead(but6) == 0) {
            y2 += 100;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(y2);
            Serial.println(y2);
            delay(355);
          }
          if (digitalRead(but7) == 0) {
            x2 += 1000;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(x2);
            Serial.println(x2);
            delay(355);
          }
          if (digitalRead(but8) == 0) {
            y2 += 1000;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(y2);
            Serial.println(y2);
            delay(355);
          }
          if (digitalRead(but9) == 0) {
            x2 += 10000;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(x2);
            Serial.println(x2);
            delay(355);
          }
          if (digitalRead(but10) == 0) {
            y2 += 10000;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(y2);
            Serial.println(y2);
            delay(355);
          }
        }
        xy2 = x2 - y2;
        Serial.println(xy);
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print(xy2);
      }
      else {
        count3 = 4;
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("multiplictation");
        delay(600);

        for (time3 == 0; time3 < 150; time3++) {
          if (digitalRead(MButton) == 0) {
            count3 = 100;
          }
          else {
            delay(10);
          }
        }
        if (count3 == 100) {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("confirmed");
          delay(750);
          lcd.clear();
          while (digitalRead(butR) == 1) {
            if (digitalRead(butL) == 0) {
              lcd.clear();
              x3++;
              lcd.setCursor(0, 0);
              lcd.print(x3);
              Serial.println(x3);
              delay(355);
            }
            if (digitalRead(but2) == 0) {
              y3++;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(y3);
              Serial.println(y3);
              delay(355);
            }
            if (digitalRead(but3) == 0) {
              x3 += 10;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(x3);
              Serial.println(x3);
              delay(355);
            }
            if (digitalRead(but4) == 0) {
              y3 += 10;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(y3);
              Serial.println(y3);
              delay(355);
            }
            if (digitalRead(but5) == 0) {
              x3 += 100;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(x3);
              Serial.println(x3);
              delay(355);
            }
            if (digitalRead(but6) == 0) {
              y3 += 100;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(y3);
              Serial.println(y3);
              delay(355);
            }
            if (digitalRead(but7) == 0) {
              x3 += 1000;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(x3);
              Serial.println(x3);
              delay(355);
            }
            if (digitalRead(but8) == 0) {
              y3 += 1000;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(y3);
              Serial.println(y3);
              delay(355);
            }
            if (digitalRead(but9) == 0) {
              x3 += 10000;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(x3);
              Serial.println(x3);
              delay(355);
            }
            if (digitalRead(but10) == 0) {
              y3 += 10000;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(y3);
              Serial.println(y3);
              delay(355);
            }
          }
          xy3 = x3 * y3;
          Serial.println(xy3);
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(xy3);
        }
        else {
          count4 = 4;
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("division");
          delay(600);

          for (time4 == 0; time4 < 150; time4++) {
            if (digitalRead(MButton) == 0) {
              count4 = 100;
            }
            else {
              delay(10);
            }
          }
          if (count4 == 100) {
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print("confirmed");
            delay(750);
            lcd.clear();
            while (digitalRead(butR) == 1) {
              if (digitalRead(butL) == 0) {
                lcd.clear();
                x4++;
                lcd.setCursor(0, 0);
                lcd.print(x4);
                Serial.println(x4);
                delay(355);
              }
              if (digitalRead(but2) == 0) {
                y4++;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(y4);
                Serial.println(y4);
                delay(355);
              }
              if (digitalRead(but3) == 0) {
                x4 += 10;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(x4);
                Serial.println(x4);
                delay(355);
              }
              if (digitalRead(but4) == 0) {
                y4 += 10;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(y4);
                Serial.println(y4);
                delay(355);
              }
              if (digitalRead(but5) == 0) {
                x4 += 100;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(x4);
                Serial.println(x4);
                delay(355);
              }
              if (digitalRead(but6) == 0) {
                y4 += 100;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(y4);
                Serial.println(y4);
                delay(355);
              }
              if (digitalRead(but7) == 0) {
                x4 += 1000;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(x4);
                Serial.println(x4);
                delay(355);
              }
              if (digitalRead(but8) == 0) {
                y4 += 1000;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(y4);
                Serial.println(y4);
                delay(355);
              }
              if (digitalRead(but9) == 0) {
                x4 += 10000;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(x4);
                Serial.println(x4);
                delay(355);
              }
              if (digitalRead(but10) == 0) {
                y4 += 10000;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(y4);
                Serial.println(y4);
                delay(355);
              }
            }
            xy4 = x4 / y4;
            Serial.println(xy4);
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print(xy4);
          }
          else {
            count5 = 4;
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print("decimalDIV");
            delay(600);

            for (time5 == 0; time5 < 150; time5++) {
              if (digitalRead(MButton) == 0) {
                count5 = 100;
              }
              else {
                delay(10);
              }
            }
            if (count5 == 100) {
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print("confirmed");
              delay(750);
              lcd.clear();
              while (digitalRead(butR) == 1) {
                if (digitalRead(butL) == 0) {
                  lcd.clear();
                  decimalx += 100;
                  lcd.setCursor(0, 0);
                  lcd.print(decimalx);
                  Serial.println(decimalx);
                  delay(355);
                }
                if (digitalRead(but2) == 0) {
                  decimaly += 100;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimaly);
                  Serial.println(decimaly);
                  delay(355);
                }
                if (digitalRead(but3) == 0) {
                  decimalx += 10;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimalx);
                  Serial.println(decimalx);
                  delay(355);
                }
                if (digitalRead(but4) == 0) {
                  decimaly += 10;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimaly);
                  Serial.println(decimaly);
                  delay(355);
                }
                if (digitalRead(but5) == 0) {
                  decimalx ++;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimalx);
                  Serial.println(decimalx);
                  delay(355);
                }
                if (digitalRead(but6) == 0) {
                  decimaly ++;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimaly);
                  Serial.println(decimaly);
                  delay(355);
                }
                if (digitalRead(but7) == 0) {
                  decimalx += 0.1;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimalx);
                  Serial.println(decimalx);
                  delay(355);
                }
                if (digitalRead(but8) == 0) {
                  decimaly += 0.1;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimaly);
                  Serial.println(decimaly);
                  delay(355);
                }
                if (digitalRead(but9) == 0) {
                  decimalx += 0.01;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimalx);
                  Serial.println(decimalx);
                  delay(355);
                }
                if (digitalRead(but10) == 0) {
                  decimaly += 0.01;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(decimaly);
                  Serial.println(decimaly);
                  delay(355);
                }
              }
              decimalxy = decimalx / decimaly;
              Serial.println(decimalxy);
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print(decimalxy);
            }
            else {
              count6 = 4;
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print("area of circle");
              delay(600);

              for (time6 == 0; time6 < 150; time6++) {
                if (digitalRead(MButton) == 0) {
                  count6 = 100;
                }
                else {
                  delay(10);
                }
              }
              if (count6 == 100) {
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print("confirmed");
                delay(750);
                lcd.clear();
                while (digitalRead(butR) == 1) {
                  if (digitalRead(butL) == 0) {
                    lcd.clear();
                    radius++;
                    lcd.setCursor(0, 0);
                    lcd.print(radius);
                    Serial.println(radius);
                    delay(355);
                  }
                  if (digitalRead(but3) == 0) {
                    radius += 10;
                    lcd.clear();
                    lcd.setCursor(0, 0);
                    lcd.print(radius);
                    Serial.println(radius);
                    delay(355);
                  }
                  if (digitalRead(but5) == 0) {
                    radius += 100;
                    lcd.clear();
                    lcd.setCursor(0, 0);
                    lcd.print(radius);
                    Serial.println(radius);
                    delay(355);
                  }
                  if (digitalRead(but7) == 0) {
                    radius += 0.1;
                    lcd.clear();
                    lcd.setCursor(0, 0);
                    lcd.print(radius);
                    Serial.println(radius);
                    delay(355);
                  }
                  if (digitalRead(but9) == 0) {
                    radius += 0.01;
                    lcd.clear();
                    lcd.setCursor(0, 0);
                    lcd.print(radius);
                    Serial.println(radius);
                    delay(355);
                  }
                }
                area = radius * pi * radius;
                Serial.println(area);
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print(area);
              }
              else {
                count7 = 4;
                lcd.clear();
                lcd.setCursor(0, 0);
                lcd.print("area of square");
                delay(600);

                for (time7 == 0; time7 < 150; time7++) {
                  if (digitalRead(MButton) == 0) {
                    count7 = 100;
                  }
                  else {
                    delay(10);
                  }
                }
                if (count7 == 100) {
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print("confirmed");
                  delay(750);
                  lcd.clear();
                  while (digitalRead(butR) == 1) {
                    if (digitalRead(butL) == 0) {
                      lcd.clear();
                      width++;
                      lcd.setCursor(0, 0);
                      lcd.print(width);
                      Serial.println(width);
                      delay(355);
                    }
                    if (digitalRead(but3) == 0) {
                      width += 10;
                      lcd.clear();
                      lcd.setCursor(0, 0);
                      lcd.print(width);
                      Serial.println(width);
                      delay(355);
                    }
                    if (digitalRead(but5) == 0) {
                      width += 100;
                      lcd.clear();
                      lcd.setCursor(0, 0);
                      lcd.print(width);
                      Serial.println(width);
                      delay(355);
                    }
                    if (digitalRead(but7) == 0) {
                      width += 0.1;
                      lcd.clear();
                      lcd.setCursor(0, 0);
                      lcd.print(width);
                      Serial.println(width);
                      delay(355);
                    }
                    if (digitalRead(but9) == 0) {
                      width += 0.01;
                      lcd.clear();
                      lcd.setCursor(0, 0);
                      lcd.print(width);
                      Serial.println(width);
                      delay(355);
                    }
                  }
                  area2 = width * width;
                  Serial.println(area2);
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print(area2);
                }
                else {
                  count8 = 4;
                  lcd.clear();
                  lcd.setCursor(0, 0);
                  lcd.print("area of");
                  lcd.setCursor(0, 1);
                  lcd.print("rectangle");
                  delay(600);

                  for (time8 == 0; time8 < 150; time8++) {
                    if (digitalRead(MButton) == 0) {
                      count8 = 100;
                    }
                    else {
                      delay(10);
                    }
                  }
                  if (count8 == 100) {
                    lcd.clear();
                    lcd.setCursor(0, 0);
                    lcd.print("confirmed");
                    delay(750);
                    lcd.clear();
                    while (digitalRead(butR) == 1) {
                      if (digitalRead(butL) == 0) {
                        lcd.clear();
                        length1++;
                        lcd.setCursor(0, 0);
                        lcd.print(length1);
                        Serial.println(length1);
                        delay(355);
                      }
                      if (digitalRead(but2) == 0) {
                        width2++;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(width2);
                        Serial.println(width2);
                        delay(355);
                      }
                      if (digitalRead(but3) == 0) {
                        length1 += 10;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(length1);
                        Serial.println(length1);
                        delay(355);
                      }
                      if (digitalRead(but4) == 0) {
                        width2 += 10;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(width2);
                        Serial.println(width2);
                        delay(355);
                      }
                      if (digitalRead(but5) == 0) {
                        length1 += 100;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(length1);
                        Serial.println(length1);
                        delay(355);
                      }
                      if (digitalRead(but6) == 0) {
                        width2 += 100;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(width2);
                        Serial.println(width2);
                        delay(355);
                      }
                      if (digitalRead(but7) == 0) {
                        length1 += 0.1;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(length1);
                        Serial.println(length1);
                        delay(355);
                      }
                      if (digitalRead(but8) == 0) {
                        width2 += 0.1;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(width2);
                        Serial.println(width2);
                        delay(355);
                      }
                      if (digitalRead(but9) == 0) {
                        length1 += 0.01;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(length1);
                        Serial.println(length1);
                        delay(355);
                      }
                      if (digitalRead(but10) == 0) {
                        width2 += 0.01;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(width2);
                        Serial.println(width2);
                        delay(355);
                      }
                    }
                    area3 = length1 * width2;
                    Serial.println(area3);
                    lcd.clear();
                    lcd.setCursor(0, 0);
                    lcd.print(area3);
                  }
                  else {
                    count9 = 4;
                    lcd.clear();
                    lcd.setCursor(0, 0);
                    lcd.print("volume of a cube");
                    delay(600);

                    for (time9 == 0; time9 < 150; time9++) {
                      if (digitalRead(MButton) == 0) {
                        count9 = 100;
                      }
                      else {
                        delay(10);
                      }
                    }
                    if (count9 == 100) {
                      lcd.clear();
                      lcd.setCursor(0, 0);
                      lcd.print("confirmed");
                      delay(750);
                      lcd.clear();
                      while (digitalRead(butR) == 1) {
                        if (digitalRead(butL) == 0) {
                          lcd.clear();
                          length2++;
                          lcd.setCursor(0, 0);
                          lcd.print(length2);
                          Serial.println(length2);
                          delay(355);
                        }
                        if (digitalRead(but2) == 0) {
                          width3++;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(width3);
                          Serial.println(width3);
                          delay(355);
                        }
                        if (digitalRead(but3) == 0) {
                          length2 += 10;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(length2);
                          Serial.println(length2);
                          delay(355);
                        }
                        if (digitalRead(but4) == 0) {
                          width3 += 10;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(width3);
                          Serial.println(width3);
                          delay(355);
                        }
                        if (digitalRead(but5) == 0) {
                          length2 += 100;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(length2);
                          Serial.println(length2);
                          delay(355);
                        }
                        if (digitalRead(but6) == 0) {
                          width3 += 100;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(width3);
                          Serial.println(width3);
                          delay(355);
                        }
                        if (digitalRead(but7) == 0) {
                          length2 += 0.1;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(length2);
                          Serial.println(length2);
                          delay(355);
                        }
                        if (digitalRead(but8) == 0) {
                          width3 += 0.1;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(width3);
                          Serial.println(width3);
                          delay(355);
                        }
                        if (digitalRead(but9) == 0) {
                          length2 += 0.01;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(length2);
                          Serial.println(length2);
                          delay(355);
                        }
                        if (digitalRead(but10) == 0) {
                          width3 += 0.01;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(width3);
                          Serial.println(width3);
                          delay(355);
                        }
                      }
                      delay(1000);
                      while (digitalRead(butR) == 1) {
                        if (digitalRead(butL) == 0) {
                          lcd.clear();
                          height++;
                          lcd.setCursor(0, 0);
                          lcd.print(height);
                          Serial.println(height);
                          delay(355);
                        }
                        if (digitalRead(but3) == 0) {
                          height += 10;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(height);
                          Serial.println(height);
                          delay(355);
                        }
                        if (digitalRead(but5) == 0) {
                          height += 100;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(height);
                          Serial.println(height);
                          delay(355);
                        }
                        if (digitalRead(but7) == 0) {
                          height += 0.1;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(height);
                          Serial.println(height);
                          delay(355);
                        }
                        if (digitalRead(but9) == 0) {
                          height += 0.01;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(height);
                          Serial.println(height);
                          delay(355);
                        }
                      }
                      volume = length2 * width3 * height;
                      Serial.println(volume);
                      lcd.clear();
                      lcd.setCursor(0, 0);
                      lcd.print(volume);
                    }
                    else {
                      count10 = 4;
                      lcd.clear();
                      lcd.setCursor(0, 0);
                      lcd.print("Surface Area Cube");
                      delay(600);

                      for (time10 == 0; time10 < 150; time10++) {
                        if (digitalRead(MButton) == 0) {
                          count10 = 100;
                        }
                        else {
                          delay(10);
                        }
                      }
                      if (count10 == 100) {
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print("confirmed");
                        delay(750);
                        lcd.clear();
                        while (digitalRead(butR) == 1) {
                          if (digitalRead(butL) == 0) {
                            lcd.clear();
                            length3++;
                            lcd.setCursor(0, 0);
                            lcd.print(length3);
                            Serial.println(length3);
                            delay(355);
                          }
                          if (digitalRead(but3) == 0) {
                            length3 += 10;
                            lcd.clear();
                            lcd.setCursor(0, 0);
                            lcd.print(length3);
                            Serial.println(length3);
                            delay(355);
                          }
                          if (digitalRead(but5) == 0) {
                            length3 += 100;
                            lcd.clear();
                            lcd.setCursor(0, 0);
                            lcd.print(length3);
                            Serial.println(length3);
                            delay(355);
                          }
                          if (digitalRead(but7) == 0) {
                            length3 += 0.1;
                            lcd.clear();
                            lcd.setCursor(0, 0);
                            lcd.print(length3);
                            Serial.println(length3);
                            delay(355);
                          }
                          if (digitalRead(but9) == 0) {
                            length3 += 0.01;
                            lcd.clear();
                            lcd.setCursor(0, 0);
                            lcd.print(length3);
                            Serial.println(length3);
                            delay(355);
                          }
                        }
                        SurfaceArea = length3 * length3 * 6;
                        Serial.println(SurfaceArea);
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print(SurfaceArea);
                      }
                      else {
                        count11 = 4;
                        lcd.clear();
                        lcd.setCursor(0, 0);
                        lcd.print("Exponent");
                        delay(600);

                        for (time11 == 0; time11 < 150; time11++) {
                          if (digitalRead(MButton) == 0) {
                            count11 = 100;
                          }
                          else {
                            delay(10);
                          }
                        }
                        if (count11 == 100) {
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print("confirmed");
                          delay(750);
                          lcd.clear();
                          while (digitalRead(butR) == 1) {
                            if (digitalRead(butL) == 0) {
                              lcd.clear();
                              number++;
                              lcd.setCursor(0, 0);
                              lcd.print(number);
                              Serial.println(number);
                              delay(355);
                            }
                            if (digitalRead(but2) == 0) {
                              exponent++;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(exponent);
                              Serial.println(exponent);
                              delay(355);
                            }
                            if (digitalRead(but3) == 0) {
                              number += 10;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(number);
                              Serial.println(number);
                              delay(355);
                            }
                            if (digitalRead(but4) == 0) {
                              exponent += 10;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(exponent);
                              Serial.println(exponent);
                              delay(355);
                            }
                            if (digitalRead(but5) == 0) {
                              number += 100;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(number);
                              Serial.println(number);
                              delay(355);
                            }
                            if (digitalRead(but6) == 0) {
                              exponent += 100;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(exponent);
                              Serial.println(exponent);
                              delay(355);
                            }
                            if (digitalRead(but7) == 0) {
                              number += 1000;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(number);
                              Serial.println(number);
                              delay(355);
                            }
                            if (digitalRead(but8) == 0) {
                              exponent += 1000;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(exponent);
                              Serial.println(exponent);
                              delay(355);
                            }
                            if (digitalRead(but9) == 0) {
                              number += 10000;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(number);
                              Serial.println(number);
                              delay(355);
                            }
                            if (digitalRead(but10) == 0) {
                              exponent += 10000;
                              lcd.clear();
                              lcd.setCursor(0, 0);
                              lcd.print(exponent);
                              Serial.println(exponent);
                              delay(355);
                            }
                          }
                          if (exponent == 2) {
                            equivalent = number * number;
                          }
                          else if (exponent == 3) {
                            equivalent = number * number * number;
                          }
                          else if (exponent == 4) {
                            equivalent = number * number * number * number;
                          }
                          else if (exponent == 5) {
                            equivalent = number * number * number * number * number;
                          }
                          else if (exponent == 6) {
                            equivalent = number * number * number * number * number * number;
                          }
                          else if (exponent == 7) {
                            equivalent = number * number * number * number * number * number * number;
                          }
                          else if (exponent == 8) {
                            equivalent = number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 9) {
                            equivalent = number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 10) {
                            equivalent = number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 11) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 12) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 13) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 14) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 15) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 16) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 17) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 18) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 19) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 20) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 21) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 22) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 23) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 24) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 25) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 26) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 27) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 28) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 29) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          else if (exponent == 30) {
                            equivalent = number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number * number;
                          }
                          Serial.println(equivalent);
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print(equivalent);
                        }
                        else {
                          count12 = 4;
                          lcd.clear();
                          lcd.setCursor(0, 0);
                          lcd.print("3 num equation");
                          delay(600);

                          for (time12 == 0; time12 < 150; time12++) {
                            if (digitalRead(MButton) == 0) {
                              count12 = 100;
                            }
                            else {
                              delay(10);
                            }
                          }
                          if (count12 == 100) {
                            lcd.clear();
                            lcd.setCursor(0, 0);
                            lcd.print("confirmed");
                            delay(750);
                            lcd.clear();
                            while (digitalRead(butR) == 1) {
                              if (digitalRead(butL) == 0) {
                                lcd.clear();
                                xx++;
                                lcd.setCursor(0, 0);
                                lcd.print(xx);
                                Serial.println(xx);
                                delay(355);
                              }
                              if (digitalRead(but2) == 0) {
                                xxx++;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxx);
                                Serial.println(xxx);
                                delay(355);
                              }
                              if (digitalRead(but3) == 0) {
                                xx += 10;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xx);
                                Serial.println(xx);
                                delay(355);
                              }
                              if (digitalRead(but4) == 0) {
                                xxx += 10;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxx);
                                Serial.println(xxx);
                                delay(355);
                              }
                              if (digitalRead(but5) == 0) {
                                xx += 100;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xx);
                                Serial.println(xx);
                                delay(355);
                              }
                              if (digitalRead(but6) == 0) {
                                xxx += 100;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxx);
                                Serial.println(xxx);
                                delay(355);
                              }
                              if (digitalRead(but7) == 0) {
                                xx += 1000;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xx);
                                Serial.println(xx);
                                delay(355);
                              }
                              if (digitalRead(but8) == 0) {
                                xxx += 1000;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxx);
                                Serial.println(xxx);
                                delay(355);
                              }
                              if (digitalRead(but9) == 0) {
                                xx += 10000;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xx);
                                Serial.println(xx);
                                delay(355);
                              }
                              if (digitalRead(but10) == 0) {
                                xxx += 10000;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxx);
                                Serial.println(xxx);
                                delay(355);
                              }
                            }
                            delay(1000);
                            while (digitalRead(butR) == 1) {
                              if (digitalRead(butL) == 0) {
                                lcd.clear();
                                xxxx++;
                                lcd.setCursor(0, 0);
                                lcd.print(xxxx);
                                Serial.println(xxxx);
                                delay(355);
                              }
                              if (digitalRead(but3) == 0) {
                                xxxx += 10;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxxx);
                                Serial.println(xxxx);
                                delay(355);
                              }
                              if (digitalRead(but5) == 0) {
                                xxxx += 100;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxxx);
                                Serial.println(xxxx);
                                delay(355);
                              }
                              if (digitalRead(but7) == 0) {
                                xxxx += 1000;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxxx);
                                Serial.println(xxxx);
                                delay(355);
                              }
                              if (digitalRead(but9) == 0) {
                                xxxx += 10000;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(xxxx);
                                Serial.println(xxxx);
                                delay(355);
                              }
                            }
                            delay(1000);
                            while (digitalRead(butR) == 1) {
                              if (digitalRead(butL) == 0) {
                                answer = xx + xxx + xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but2) == 0) {
                                answer = xx - xxx - xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but3) == 0) {
                                answer = xx * xxx * xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but4) == 0) {
                                answer = xx / xxx / xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but5) == 0) {
                                answer = xx + xxx - xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but6) == 0) {
                                answer = xx * xxx / xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but7) == 0) {
                                answer = xx - xxx + xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but8) == 0) {
                                answer = xx / xxx * xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but9) == 0) {
                                answer = xx + xxx * xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but10) == 0) {
                                answer = xx - xxx / xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                            }
                            delay(1000);
                            while (digitalRead(butR) == 1) {
                              if (digitalRead(butL) == 0) {
                                answer = xx + xxx / xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but2) == 0) {
                                answer = xx - xxx * xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but3) == 0) {
                                answer = xx * xxx + xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but4) == 0) {
                                answer = xx / xxx - xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but5) == 0) {
                                answer = xx / xxx + xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but6) == 0) {
                                answer = xx * xxx - xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but7) == 0) {
                                answer = xx - xxx + xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                              if (digitalRead(but8) == 0) {
                                answer = xx / xxx * xxxx;
                                lcd.clear();
                                lcd.setCursor(0, 0);
                                lcd.print(answer);
                              }
                            }
                          }

                          xx = 0;
                          xxx = 0;
                          xxxx = 0;
                          count12 = 4;
                          time12 = 0;
                        }
                        number = 0;
                        exponent = 0;
                        equivalent;
                        count11 = 4;
                        time11 = 0;
                      }
                      length3 = 0;
                      SurfaceArea = 0;
                      count10 = 4;
                      time10 = 0;
                    }
                    length2 = 0;
                    width3 = 0;
                    height = 0;
                    volume = 0;
                    count9 = 4;
                    time9 = 0;
                  }
                  length1 = 0;
                  width2 = 0;
                  area3 = 0;
                  count8 = 4;
                  time8 = 0;
                }
                width = 0;
                area2 = 0;
                count7 = 4;
                time7 = 0;
              }
              radius = 0;
              area = 0;
              count6 = 4;
              time6 = 0;
            }
            decimalx = 0;
            decimaly = 0;
            decimalxy = 0;
            count5 = 4;
            time5 = 0;
          }
          x4 = 0;
          y4 = 0;
          xy4 = 0;
          count4 = 4;
          time4 = 0;
        }
        x3 = 0;
        y3 = 0;
        xy3 = 0;
        count3 = 4;
        time3 = 0;
      }
      x2 = 0;
      y2 = 0;
      xy2 = 0;
      count2 = 4;
      time2 = 0;
    }
    x = 0;
    y = 0;
    xy = 0;
    count = 4;
    time1 = 0;
  }
}

Credits

bigboibobhacker

bigboibobhacker

0 projects • 0 followers

Comments