Page 206 - MDP2020-1
P. 206
| 인천전자마이스터고등학교 ·············································································································
200
void printDetail(uint8_t type, int value);
void setup()
{
//DFPlayer 시리얼 설정 9600
mySoftwareSerial.begin(9600);
//모니터용 시리얼 설정 115200
Serial.begin(115200);
//DFPlayer 시리얼을 DFPlayer 클래스에 연결시킨 다음
// 시작!
if (!myDFPlayer.begin(mySoftwareSerial)) { //Use softwareSerial to communicate with
mp3.
//SDCARD가 없거나
//통신이 제대로 연결 안되면
//에러 메시지 출력 후 정지
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true);
}
// 시작을 알림
Serial.println(F("DFPlayer Mini online."));
//소리 크기 설정 ( 0 ~ 30 )
myDFPlayer.volume(30); //Set volume value. From 0 to 30
pinMode(7, INPUT);
pinMode(4, INPUT);
}
void loop()
{
knock = digitalRead(4);
if(knock==HIGH){
people = digitalRead(7);