#include "LedControl.h"
#include "Keypad.h"
#define C4 262
#define D4 294
#define E4 330
#define F4 349
#define G4 392
#define A4 440
#define B4 494
#define C5 523
char keys [4][4]={
{7,8,9,0},
{4,5,6,0},
{1,2,3,0},
{0,0,0,0}};
byte rowPins[] = {7,6,5,4};
byte colPins[] = {3,2,1,0};
Keypad keypad = Keypad(makeKeymap(keys),rowPins,colPins,4,4);
int melody[]= {C4,D4,E4,F4,G4,A4,B4,C5};
int dl=300;
int buzzerpin = 11;
LedControl lc=LedControl(8,10,9,1);
void setup()
{
lc.shutdown(0,false);
lc.setIntensity(0,5);
lc.clearDisplay(0);
pinMode(buzzerpin,OUTPUT);
digitalWrite(buzzerpin.HIGH);
}
void loop()
{
char key = keypad.getKey();
if ((key != NO_KEY) && (key < 9))
{
lc.setDigit(0,0,key,false);
tone(buzzerpin, melody[key-1],d1);
delay(d1);
digitalWrite(buzzerpin.HIGH);
}
}
Thursday, February 7, 2019
Subscribe to:
Post Comments (Atom)
MINI Project ตัวจับเวลา
#include <LiquidCrystal.h> LiquidCrystal lcd(7,6,5,4,3,2); const int set = 8; int hours=10; int start=11; int relay=9; ...

-
สัญลักษณ์ Flowchart คือ รูปภาพที่ใช้แทนความหมายการทำงานในลักษณะต่างๆ ภายในผังงาน (Flowchart) ประกอบไปด้วย การเริ่มต้น (Start), ก...
-
#include "LedControl.h" #include "Keypad.h" #define C4 262 #define D4 294 #define E4 330 #define F4 349 #defin...
No comments:
Post a Comment