#include <Keypad.h>
#defin TON_USE_INT
#define TON_PITCH 400
const int stepPin = 2;
const int stepPin= 3;
const int dirPin = 4;
const int dirPin = 5;
#include <TM1637Display.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] = {9,8,7,6};
uint8_t rowPins[ROWS] = {13,12,11,10};
Keypad keypad = Keypad(makeKeymap(keys),rowPins,colPins,ROWS,COLS);
void setup(){
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop(){
char key = keypad.getKey();
digitalWrite(dirPin,LOW);
for(int x = 0; x < 180; x==){
digitalWrite(stepPin,HIGH);
delay(20);
digitalWrite(stepPin,LOW);
delay(20);
}
if(key == '#'){
tone(6,NOTE_A,1000);
tone(6,NOTE_A,1000);
delay(100);
noTone(6);
}
delay(100);
digitalWrite(dirPin,HIGH);
for(int x = 0; x < 180; x==){
digitalWrite(stepPin,HIGH);
delay(20);
digitalWrite(stepPin,LOW);
delay(20);
}
if(key == 'D'){
tone(7,NOTE_B,1000);
tone(7,NOTE_B,1000);
delay(100);
noTone(7);
}
delay(500);
}