Page 53 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 53
#define NFC_ON 3
static void
print_hex(const uint8_t *pbtData, const size_t szBytes)
{
size_t szPos;
int check=0;
int data[4] = {0x24,0x00,0xa8,0x7b}; //카드
int data2[4] = {0xdf,0xca,0x09,0xd2}; //휴대폰
char cmd[26];
char tts[128];
char say[14];
for (szPos = 0; szPos < szBytes; szPos++) {
if(data[szPos]==pbtData[szPos]||data2[szPos]==pbtData[szPos]) check ++;
}
if(check>=4)
{
strcpy(cmd,"pico2wave --wave open.wav ");
strcpy(say,"aplay open.wav");
system(tts);
system(say);
digitalWrite(NFC_RIGHT,1);
digitalWrite(NFC_WRONG,0);
while(digitalRead(NFC_ON));
strcpy(cmd,"pico2wave --wave close.wav ");
strcpy(say,"aplay close.wav");
system(tts);
system(say);
printf("OK");
}
else
{
digitalWrite(NFC_RIGHT,0);
digitalWrite(NFC_WRONG,1);
printf("no");
- 46 -