#include <Keypad.h>
const uint8_t ROWS = 4;
const uint8_t COLS = 4;
char keys[ROWS][COLS] = {
{ '1', '2', '3', 'A' },
{ '4', '5', '6', 'B' },
{ '7', '8', '9', 'C' },
{ '*', '0', '#', 'D' }
};
uint8_t colPins[COLS] = { 5, 4, 3, 2 }; // Pins connected to C1, C2, C3, C4
uint8_t rowPins[ROWS] = { 9, 8, 7, 6 }; // Pins connected to R1, R2, R3, R4
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
#include <Stepper.h>
int stepsPerRevolution=200;
int motSpeed=10;
int dt=500;
int j;
int Zadanikut;
int kut=200;
int brojRupa;
int busenje;
String msg="A:Odaberi kut";
String msg1="B:Odaberi broj rupa";
String msgA="Koliki je kut?";
String msgB="Koliko rupa :";
String msgC="Za nastavak X ";
String odgovor;
char odgovor1;
char curentPosition;
Stepper myStepper = Stepper(stepsPerRevolution, 10,11,12,13);
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
Serial.begin(9600);
myStepper.setSpeed(motSpeed);
Serial.println(msg);
Serial.println(msg1);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(msg);
lcd.setCursor(0, 1);
lcd.print(msg1);
delay(50);
}
void loop() {
char key = keypad.getKey();
if (int(key) !=0) {
lcd.setCursor(0,16);
Serial.println(key);
}
if(key=='A'){
lcd.clear();
Serial.println(msgA);
lcd.setCursor(0, 0);
lcd.print(msgA);
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
for(j=0;j<=curentPosition;++j){
lcd.print("*");
}
myStepper.step(kut);
}
}