2019年11月28日 星期四

week12

複習案按鍵有聲音


















int Do =523;
int Re =587;
int Mi =659;
int Fa =698;
int So =784;
int song[11]={Do,Re,Mi,Do,Do,Re,Mi,Do,Mi,Fa,So};
int now=0;
bool UP=true;
void setup() {
  pinMode(8,OUTPUT);
  pinMode(2,INPUT_PULLUP);
}
int i=0;
void loop() {
  // put your main code here, to run repeatedly:
  if(UP && digitalRead(2)==LOW){ 
    tone(8, song[now],200);
    UP=false;
    now=(now+1)%11;
    
  }
  else {
  UP=true;  
  }
  delay(100);
}



用pin腳去控制聲音



















用p語言來寫網路程式










讓他發送訊息







沒有留言:

張貼留言

alanhc 互動技術-week17 [final]

回顧這學期的作品:  期中作業:LANDING:PLANET 賣點&特點: 炫麗的特效 物理(星球重力及降落)及粒子系統(噴射) 世界地圖可根據視角縮放 困難點: 重寫3次最終改寫成物件導向的CLASS寫法...