Page 25 - MDP2022-2
P. 25
Serial.print("2번 포토 인식 : ");
Serial.println(last_poto);
unsigned long speed_time = (last_poto - fir_poto);
score = map(speed_time, 0, 1000000, 99, 0);
if (score > 99 || score < 0) {
Serial.println("에러");
int temp = random(0,90);
score = temp;
}
score = score * 100;
int temp = random(0, 100);
score += temp;
Serial.print("speed_time: ");
Serial.print(speed_time);
Serial.print("score : ");
Serial.println(score);
NFC_check();
reset_flag = 1;
Serial.println("NFC_reset 줬음");
digitalWrite(NFC_re, LOW);
delay(10);
digitalWrite(NFC_re, HIGH);
}
delay(500);
}
void setup() {
//ESP.wdtFeed(); //ESP와치독 끄기
Serial.begin(115200);
mySerial.begin(115200);
mp3_set_serial(mySerial);
delay(1);
mp3_set_volume(10);
Wire.begin(I2C_SDA, I2C_SCL); //GPIO4: SDA, GPIO5: SCL
pinMode(Coin, INPUT);
//pinMode(NFC_SCL,OUTPUT);
//pinMode(NFC_SDA,OUTPUT);
pinMode(NFC_re, OUTPUT);
pinMode(Poto_1, INPUT);