/**
Arduino Calculator
Copyright (C) 2020, Uri Shaked.
Released under the MIT License.
*/
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <Servo.h>
#include <stdio.h>
#include <stdlib.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
const byte KEYPAD_ROWS = 4;
const byte KEYPAD_COLS = 4;
byte rowPins[KEYPAD_ROWS] = {5, 4, 3, 2};
byte colPins[KEYPAD_COLS] = {A3, A2, A1, A0};
char keys[KEYPAD_ROWS][KEYPAD_COLS] = {
{'1', '2', '3', ' '},
{'4', '5', '6', ' '},
{'7', '8', '9', ' '},
{' ', '0', ' ', ' '}
};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, KEYPAD_ROWS, KEYPAD_COLS);
uint64_t value = 0;
//variables
String inputText = "";
void updateCursor() {
if (millis() / 250 % 2 == 0 ) {
lcd.cursor();
} else {
lcd.noCursor();
}
}
void ascendString(string &text){
lcd.clear()
lcd.print("123")
}
void setup() {
Serial.begin(115200);
lcd.begin(16, 2);
lcd.clear();
lcd.cursor();
lcd.setCursor(1, 0);
}
uint64_t currentDecimal;
bool decimalPoint = false;
void processInput(char key) {
if (key == +){
}
else if (key != ' ')
inputText = inputText + key;
lcd.clear();
lcd.print(text);
}
void loop() {
updateCursor();
char key = keypad.getKey();
if (key) {
processInput(key);
}
}