顯示具有 01161096_鄒宜臻 標籤的文章。 顯示所有文章
顯示具有 01161096_鄒宜臻 標籤的文章。 顯示所有文章

2015年1月18日 星期日

Week19

-------------------------------↓↓太鼓達人↓↓-------------------------------

(外觀)


(內部接線)

-------------------------------↓↓Demo影片↓↓-------------------------------


期末作品




期末作品


太鼓達人


import ddf.minim.*; Minim minim; AudioPlayer mu0,mu1,mu2,mu3,mu4,mu5; import processing.serial.*; Serial myPort; PImage img,imgBG,drum,B,R,P; int time=450*4; int runX[] = new int[100]; int drumcolor[] = new int[100]; int score=0; int but; void setup() { myPort = new Serial(this, "COM3", 9600); size(1200,390); imgBG = loadImage("BG.png"); drum = loadImage("drum.png"); B = loadImage("B.png"); R = loadImage("R.png"); P = loadImage("P.png"); imgBG.resize(1200,390); imageMode(CENTER); runX[0]=1050; for(int i=1;i<100;i++) { runX[i] = runX[i-1] + int(random(100,400)); } for(int i=0;i<100;i++) { drumcolor[i] = int(random(1,3)); } minim = new Minim(this); mu0 = minim.loadFile("Do_Do_Do.mp3"); mu1 = minim.loadFile("hitclap.mp3"); mu2 = minim.loadFile("slidertick.mp3"); mu0.rewind(); mu0.play(); } void draw() { background(imgBG); time--; textSize(30); fill(0, 0, 0); text(time/60,80,120); textSize(20); fill(0, 0, 0); text("Time:",75,80); if (myPort.available()>0) { but = myPort.read(); } col(); button(); image(drum,102,288,205,205); textSize(40); fill(0, 0, 0); text("Score:",850,150); textSize(40); fill(0, 0, 0); text(score,980,150); if(time==0) { minim.stop(); background(0, 0, 0); textSize(30); fill(250, 150, 0); text("Time's up",470,100); text("Your score is",450,150); textSize(80); text(score, 445,250); noLoop(); } } void col() { for(int i=0;i<100;i++) { if(drumcolor[i]==1) { image(B,runX[i]-=5,276,130,130); } if(drumcolor[i]==2) { image(R,runX[i]-=5,276,130,130); } } } void button() { if(but =='B') { for(int i=0;i<100;i++) { if(drumcolor[i]==1) { if(runX[i]<310&&runX[i]>270) { image(P,runX[i]-=5,276,130,130); score+=50; mu1.rewind(); mu1.play(); } } } println("B"); } if(but=='R') { for(int i=0;i<100;i++) { if(drumcolor[i]==2) { if(runX[i]<310&&runX[i]>270) { image(P,runX[i],276,130,130); score+=50; mu2.rewind(); mu2.play(); } } } println("R"); } if(but=='N') { println("N"); } }








My teammate :-)





2014年12月15日 星期一

第十四週課堂作業

旋鈕 (可變電阻) Analog Input


int sensorPin = A0;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);  
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin, HIGH);  
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);          
  // turn the ledPin off:        
  digitalWrite(ledPin, LOW);   
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);                  

}







2014年12月8日 星期一

第十三周課堂作業


馬達

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
 
 
void loop() 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
}





按按鈕回傳反應


void setup(){
 Serial.begin(9600);
 pinMode(2, INPUT_PULLUP);
}

void loop(){
  while (Serial.available()>0)  {
   char  data = Serial.read();
   Serial.print(data);
   }
   if(digitalRead(2)==LOW)Serial.println("I Love You");
   else Serial.println("I Don't Love You");
}




2014年12月1日 星期一

第十二周課堂作業



/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}



/*
  Button

 Turns on and off a light emitting diode(LED) connected to digital  
 pin 13, when pressing a pushbutton attached to pin 2. 
 The circuit:
 * LED attached from pin 13 to ground 
 * pushbutton attached to pin 2 from +5V
 * 10K resistor attached to pin 2 from ground
 * Note: on most Arduinos there is already an LED on the board
 attached to pin 13.
 created 2005
 by DojoDave <http://www.0j0.org>
 modified 30 Aug 2011
 by Tom Igoe
 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/Button
 */
// constants won't change. They're used here to 
// set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin
// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status
void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);     
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}
/*
  Melody

 Plays a melody

 circuit:
 * 8-ohm speaker on digital pin 8

 created 21 Jan 2010
 modified 30 Aug 2011
 by Tom Igoe

This example code is in the public domain.

 http://arduino.cc/en/Tutorial/Tone

 */
 #include "pitches.h"
#define NO_SOUND 0 // make the rests in music
// notes in the melody:
int melody[] = {
NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_DS5,NOTE_D5,NOTE_B4,NOTE_A4,NOTE_B4,
  NOTE_E4,NOTE_G4,NOTE_DS5,NOTE_D5,NOTE_G4,NOTE_B4,
  NOTE_B4,NOTE_FS5,NOTE_F5,NOTE_B4,NOTE_D5,NOTE_AS5,
  NOTE_A5,NOTE_F5,NOTE_A5,NOTE_DS6,NOTE_D6,NO_SOUND};


// note durations: 4 = quarter note, 8 = eighth note, etc.:
float noteDurations[] = {
8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,2,8,8,1,
  8,4,8,4,8,8,
  8,8,4,8,4,8,
  4,8,4,8,3};

void setup() {
  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote <54; thisNote++) {

    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations[thisNote];
    tone(8, melody[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
  }
}

void loop() {
  // no need to repeat the melody.
}





2014年11月24日 星期一

第十一週課堂作業

先拿出一個電路板(大的或小的皆可)
拿出一條USB線,將電腦與電路板相連
電路板綠燈亮!
控制台 > 裝置管理員


看此裝置是com ?

Arduino > Tool > Board
Arduino > Tool > Serial Port

LED燈 短腳(負) , 長腳(正)

先按勾勾再按箭頭執行



LED 5燈連續發光
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeated
  This example code is in the public domain.
 */

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int a = 13;
int b = 12;
int c = 11;
int d = 10;
int e = 9;
// the setup routine runs once when you press reset:
void setup() {              
  // initialize the digital pin as an outpu
  pinMode(a, OUTPUT);  
  pinMode(b, OUTPUT);
  pinMode(c, OUTPUT);
  pinMode(d, OUTPUT);
  pinMode(e, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(a, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(150);               // wait for a second
  digitalWrite(a, LOW);    // turn the LED off by making the voltage LOW
  delay(150);               // wait for a second
  digitalWrite(b, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(150);               // wait for a second
  digitalWrite(b, LOW);    // turn the LED off by making the voltage LOW
  delay(150);               // wait for a second
  digitalWrite(c, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(150);               // wait for a second
  digitalWrite(c, LOW);    // turn the LED off by making the voltage LOW
  delay(150);               // wait for a second
  digitalWrite(d, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(150);               // wait for a second
  digitalWrite(d, LOW);    // turn the LED off by making the voltage LOW
  delay(150);               // wait for a second
  digitalWrite(e, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(150);               // wait for a second
  digitalWrite(e, LOW);    // turn the LED off by making the voltage LOW
  delay(150);               // wait for a second

}


燈泡有循環~~~

第10週業界講師授課心得報告

103 年教學卓越計畫子計畫一
雙師課程
學生心得報告
姓名 : 鄒宜臻
系所 : 資訊傳播工程學系
班級 : 三乙
學號 : 01161096
主題 : 愛迪斯科技­_胡啟彥講師

愛迪斯科技股份有限公司(Axis3D Technology Co., LTD )是專門為大中華地區提供3D虛擬科技完整解決方案的高科技服務公司。

公司自2000年成立以來,不斷地引進了歐洲與北美世界知名的虛擬實境技術(VR, Virtual Reality)、擴增實境技術(AR, Augmented Reality)、動態擷取技術(Mocap, Motion Capture)、力回饋技術(Force Feedback)與跨平台發佈技術(MP, Multi-Platform),並依據中國市場的產業科研發展趨勢,提供大中華區航太、航空、汽車、造船、高校教育、科研單位與展覽展示行業等行業的3D虛擬科技解決方案。
愛迪斯科技目前已服務過800家以上的重點客戶,成功贏得各領域客戶一致肯定,擁有良好的服務口碑與品牌影響力。展望未來,我們將持續投入對3D技術的專注與熱情,堅持「創新開發」、「卓越質量」和「專業服務」的基本理念,不斷地強化公司核心價值與技術優勢,召收國際化的優秀人才與聯合全球先進的合作夥伴,共同向“愛迪斯─3D虛擬科技解決方案第一領導品牌”的願景邁進。


我覺得這次來的胡講師,較上次的曾講師講得來的生動,有較多的範例和公司與外界成功的案例供我們參考。可能是曾先生較年輕且與公司成立時間較為短有關。不過我們都從中吸收到不少,很多學校老師沒教的事!

2014年10月30日 星期四

期中作業

期中作品 _

http://youtu.be/SkkMbWZBUGA


可以左右控制中間的嬰兒

有音效 請開最大聲!

作業已上傳至youtube~

2014年10月13日 星期一

第五周課堂作業

{期中作品分析}

主題:女孩向上跑

遊戲中有一個女孩,沿著牆壁向上爬,
中途有果實或獎勵(吃一個100分),
對向的果實或獎勵要跳到另一側吃。
爬的過程中會遇上障礙物(撞到一個扣1000分),
即跳到另一側,才不會撞到減少生命,
有三次撞到障礙物或吃到炸彈的機會,
集滿三次 遊戲即結束。

1.1 背景圖,有兩面牆
1.2 畫出人物,腳會動
1.3 隨機出現的果實獎勵
1.4 隨機出現的障礙物和炸彈
1.5 左上有剩餘的生命數
1.6 右上有累積分數
1.7 遊戲結束後,GAME OVER 

http://game.slime.com.tw/2014/08/16/%E8%90%8C%E5%A6%B9%E5%90%91%E4%B8%8A%E8%B7%91/

2014年10月6日 星期一

第四周課堂作業




會轉動的花
void setup(){
  size(600,400);
}
void draw(){
  translate(mouseX,mouseY);
  rotate(0.01*frameCount);
  fill(#FF6464); ellipse(0,0, 80,180);
  rotate(PI/4);
  fill(#FF6464); ellipse(0,0, 80,180);
  rotate(PI/4);
  fill(#FF6464); ellipse(0,0, 80,180);
  rotate(PI/4);
  fill(#FF6464); ellipse(0,0, 80,180);
  rotate(PI/4);
  fill(#FF7C17); ellipse(0,0, 80,80);
}

彩色的花朵(會轉)

void setup(){
  size(600,400);
}
void draw(){
  fill(mouseX,mouseY,400);
  translate(mouseX,mouseY);
  rotate(0.01*frameCount);
  for(int i=0;i<4;i++){
    ellipse(0,0,80,180);
    rotate(PI/4);
  }
  fill(#FF7C17);
  ellipse(0,0, 80,80);
}

2014年9月29日 星期一

第三周課堂作業


讀取網路上的影像檔
size(800,600);
PImage img = loadImage("http://metrouk2.files.wordpress.com/2014/03/sherlock-benedict-martin.jpg");
image(img, 0,0, 700,450);

讀取圖片(隨滑鼠移動)
PImage img;
void setup(){
size(800,600);
img = loadImage("bus.png");
imageMode(CENTER);
}
void draw(){
  background(0,255,0);
  image(img, mouseX,mouseY, 300,300);
}

加上背景 還有白球
PImage img, imgBG;
float eggX=750, eggY=550, eggVX, eggVY, flying=0;
void setup() {
  size(800, 600);
  img = loadImage("bus.png");
  imgBG = loadImage("bg.png");
  imgBG.resize(800, 600);
  imageMode(CENTER);
}
void draw() {
  background(imgBG);
  image(img, mouseX, mouseY, 300, 300);
  if (flying>0) {
    ellipse(eggX, eggY, 50, 50);
    eggX+= eggVX;
    eggY+= eggVY;
    flying--;
  }
}
void mousePressed() {
  eggX=750; 
  eggY=550; 
  flying=30;
  eggVX= (mouseX-eggX)/30;
  eggVY= (mouseY-eggY)/30;
}
加上音效 喇叭聲
import ddf.minim.*;
Minim minim;
AudioPlayer brake2;
PImage img, imgBG;
float eggX=750, eggY=550, eggVX, eggVY, flying=0;
void setup() 
{
  size(800, 600);
  minim = new Minim(this);
  img = loadImage("bus.png");
  imgBG = loadImage("bg.png");
  imgBG.resize(800, 600);
  imageMode(CENTER);
  brake2 = minim.loadFile("carhn.wav");

}
void draw() {
  background(imgBG);
  image(img, mouseX, mouseY, 300, 300);
  if (flying>0) {
    ellipse(eggX, eggY, 50, 50);
    eggX+= eggVX;
    eggY+= eggVY;
    flying--;
  }
}
void mousePressed() {
  eggX=750; 
  eggY=550; 
  flying=30;
  eggVX= (mouseX-eggX)/30;
  eggVY= (mouseY-eggY)/30;
  
  brake2.rewind();
  brake2.play();
}



2014年9月22日 星期一

第二周課堂作業


加入課程


方塊隨滑鼠移動

用滑鼠畫線(不需按滑鼠)

 用滑鼠畫線(按著滑鼠才畫)

隨方塊顏色 更換畫筆顏色

調整畫筆粗細
void setup(){
  size(800,600); background(#FAFC20);
  rect(700,0, 100,100); ellipse(750,50, 5,5);
  rect(700,100, 100,100); ellipse(750,150, 10,10);
  rect(700,200, 100,100); ellipse(750,250, 15,15);
  fill(255,0,0); rect(0,0, 100,100);
  fill(0,255,0); rect(0,100, 100,100);
  fill(0,0,255); rect(0,200, 100,100);
  fill(0); rect(0,300, 100,100);
}
void draw(){
  if (mousePressed) line(mouseX,mouseY, pmouseX,pmouseY);
}
void mousePressed(){
  println(mouseX+" "+mouseY);
  if (mouseX<100 && mouseY<100) stroke(255,0,0);
  else if (mouseX<100 && mouseY<200) stroke(0,255,0);
  else if (mouseX<100 && mouseY<300) stroke(0,0,255);
  else if (mouseX<100 && mouseY<400) stroke(0);
  else if (mouseX>700 && mouseY<100) strokeWeight(5);
  else if (mouseX>700 && mouseY<200) strokeWeight(10);
  else if (mouseX>700 && mouseY<300) strokeWeight(15);
}