You are viewing a single comment's thread from:
RE: 아두이노 코딩-24: I2C lcd 디스플레이 노래가사와 함께하는 클레멘타인 연주(동영상 업데이트 완료)
잘만드셨네요.
코딩 부분만 대폭 재미 삼아서 대폭 줄여 봤어요.
가상시뮬레이터로 테스트 해 봤네요.
https://www.tinkercad.com/things/edUwbt2iTwn
char memo[16][17] ={
"In a ca-vern",
"In a can-yon",
"ex-ca-vat-ing",
"for a mine",
"dwelt a min-er",
"for-ty nin-er",
"and his daughter",
"Cle-men-tine",
"Oh my dar-ling",
"Oh my dar-ling",
"Oh my dar-ling",
"Cle-men-tine",
"You are lost and",
"gone for-ev-er",
"dread-ful sor-ry",
"Cle-men-tine"
};
void setup() {
lcd.begin(16,2);
lcd.setCursor(0, 0);
lcd.print("Hello Steemit Guys!");
lcd.setCursor(0,1);
lcd.print("Enjoy Clementine!");
delay(3000);
for(int i=0;i<15;i++){
if(i%2 == 0){
lcd.clear();
lcd.setCursor(0,0);
}
else{
lcd.setCursor(0,1);
}
lcd.print(memo[i]);
if(i==14){
lcd.setCursor(0,1);
lcd.print(memo[i+1]);
}
for(int j=i*4;j<4+i*4;j++){
int noteDuration = 1000 / noteDurations[j];
tone(speakerPin, melody[j], noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(speakerPin);// stop the tone playing:
}
}
}
역쉬 아주 콤팩트하군요! 돌려 보니까 잘 돌구요, 근데 딱하나 차이점이 다끝나고 마지막에 붕 소리가 나는데 뭔가 마지막 처리해야 하는것이 있나 모르겠군!