(1) 請不要忘了帶 Arduino Starter Kit 的實驗設備到學校哦!
(2) 明大要上課的內容是 Project 05 06 07 哦! 同學們今晚可以預習一下。
(3) 我們上課的目的,是為了讓同學們在期末完成自己構思的創意作品,
(4) 明天同學們記得帶 9V 的方塊電池(25元-60元一顆), 還有找找家裡有沒有一些要用電池的廉價的玩具, 我們可以在學校享受動手改裝的樂趣!
project5
//程式碼
int sensorValue; int sensorLow=1023; int sensorHigh=0; const int ledPin = 13; void setup(){ pinMode(ledPin,OUTPUT); digitalWrite(ledPin,HIGH); while(millis()<5000){ sensorValue = analogRead(A0); if(sensorValue > sensorHigh){ sensorHigh = sensorValue; } if(sensorValue < sensorLow){ sensorLow = sensorValue; } } digitalWrite(ledPin,LOW); } void loop(){ sensorValue = analogRead(A0); int pitch = map(sensorValue,sensorLow,sensorHigh,50,4000); tone(8,pitch,20); delay(10); }
//影片
project7
//程式碼
//int buttons[6];
//int buttons[0] = 2;
int notes[]={262,294,330,349};
void setup(){
Serial.begin(9600);
}
void loop(){
int keyVal = analogRead(A0);
Serial.println(keyVal);
if(keyVal==1023){
tone(8,notes[0]);
}
else if(keyVal >= 990 && keyVal <= 1010){
tone(8,notes[1]);
}
else if(keyVal >= 505 && keyVal <= 515){
tone(8,notes[2]);
}
else if(keyVal >= 5 && keyVal <= 10){
tone(8,notes[3]);
}
else{
noTone(8);
}
}
//影片
沒有留言:
張貼留言