Page 31 - MDP2022-2
P. 31
}
void sendToMaster()
{
Serial.println("마스터 달라고하는 값(마스터에게 보냄)");
Wire.write(uid_1);
Serial.print(uid_1);
Wire.write(uid_2);
Serial.print(uid_2);
Wire.write(uid_3);
Serial.print(uid_3);
Wire.write(uid_4);
Serial.print(uid_4);
Wire.write(uid_5);
Serial.print(uid_5);
Wire.write(uid_6);
Serial.print(uid_6);
Wire.write(uid_7);
Serial.print(uid_7);
Wire.write(uid_8);
Serial.println(uid_8);
uid_1 = '0', uid_2 = '0', uid_3 = '0', uid_4 = '0', uid_5 = '0', uid_6 = '0', uid_7 = '0', uid_8 = '0
';
}
void setup() {
Serial.begin(115200);
mySerial.begin(115200);
mp3_set_serial(mySerial);
delay(1);
mp3_set_volume(10);
Wire.begin(I2C_address); // I2C 슬라이브 address #2
Wire.onRequest(sendToMaster); // 마스터 데이터요청을 함수를 실행한다(돌려 보내야하는
값)
//Wire.onReceive(I2C_receiveEvent); // I2C 이벤트 발생시 실행할 함수지정(실행명령:머머해라)
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata) {
Serial.print("Didn't find PN53x board");
while (1); // halt
}
// Got ok data, print it out!