顯示具有 99160175林品妤 標籤的文章。 顯示所有文章
顯示具有 99160175林品妤 標籤的文章。 顯示所有文章

2013年1月20日 星期日

Week11,HW09


1.結合可做出什麼:
感覺電腦的遊戲改善之後都可以利用Arduino來玩
原本只是鍵盤滑鼠操作,現在可以變成按鈕,機器人等等
會更栩栩如生,更有趣

2.一個相關Arduino的影片:
他結合了魔術方塊,很有趣的遊戲跟結合
令人佩服~


Week15,hw12

本週進度:
我們大致都討論出來,靈感是來自於其中的作品
把它運用到麵包版上,感覺又有另一種感覺
主要是運用4個按鈕,代表不同顏色
一種反應遊戲~
希望我們可以成功!

心得:
原本覺得這是一個無法成功的遊戲
沒想到我們一步一步地接近了
詢問學長跟不斷改善
我們的作品快完成了
很開心上這堂課有這機會,這真的是不一樣的體驗和感受
希望大家會喜歡玩我們的作品

大致半成品:




arduino程式碼:

int buttonPin5 = 5;
int buttonPin2 = 2;
int buttonPin3 = 3;
int buttonPin4 = 4;

int buttonState5 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
void setup() {,tgy

  pinMode(buttonPin5, INPUT);
  pinMode(buttonPin2, INPUT);
  pinMode(buttonPin3, INPUT); 
  pinMode(buttonPin4, INPUT);

  Serial.begin(9600);

}
void loop() {
  buttonState5 = digitalRead(buttonPin5);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);

  if (buttonState5 == HIGH) {
   //tone(8, 131, 300);
   Serial.write('A');
  }
  else if (buttonState5 == LOW) {
   //Serial.write('Z');
  }

  if (buttonState2== HIGH) {
   //tone(8, 147 , 300);
   Serial.print('S');
  }
  else if (buttonState2 == LOW) {
   //Serial.write('X');
  }

  if (buttonState3 == HIGH) {
   //tone(8, 165 , 300);
   Serial.print('D');
  }
   else if (buttonState3 == LOW) {
   //Serial.write('C');
  }

  if (buttonState4 == HIGH) {
   //tone(8, 175 , 300);
   Serial.print('F');
  }
   else if (buttonState4 == LOW) {
   //Serial.write('V');
  }
  if(buttonState2 == LOW&&buttonState3 == LOW&&buttonState4 == LOW&&buttonState5 == LOW){
  Serial.write('H');
  }
   delay(500);
}

Week13,HW11

影片:


心得:
我們成功做出五個按鈕,個代表五個音階,簡直就是簡易型的小鋼琴,
一開始有些瓶頸,後來詢問修改後,成功的做出來了,
很有趣也很好玩,感覺又學到了一些東西!
曲子是小蜜蜂~

WEEK 19,Final




程式碼:
processing:


import processing.serial.*;
Serial myPort;

int i,d1=0,d2=0,d3=0,d4=0;
int score=0, lastTime=60;
int[] value = new int[50000];
color[] c=new color[4];
int a,count=0;
int tmp=0;
int startt;
int val;
void setup(){
  size(500,600);
  myPort = new Serial(this, "COM4", 9600);
 
  c[0]=color(255,0,0);
  c[1]=color(0,255,0);
  c[2]=color(0,0,255);
  c[3]=color(255,255,255);
  for(i=0;i<10000;i++)
  {
    a=int(random(0,3.99));
    /*
    if(i%25==0)
      fill(255,0,0);
      else  if(i%30==0)
          fill(0,255,0);
          else  if(i%40==0)
              fill(0,0,255);
              else
              fill(255,255,255);
    */
    count%=50000;
    value[count++]=a;
  }
}
void draw(){
  background(255,200,100);
  if(myPort.available()>0){
    val = myPort.read();//
第三個重點:如果讀到數字就拿出來用
    //println("123");
  }
textSize(30);
fill(100,0,50);
text("Time:"+lastTime, 50,80);
text("Score:"+score, 0,220);
 if(lastTime==0){
      stop();
      textFont(createFont("3", 60));
      background(100,100,100);
      fill(255,255,255);
      text("Game Over ",120,250);
      text("Your score:"+score,0,350);
 }
lastTime=30-millis()/1000;

    i=200;
    for(int k=startt;k<startt+20;k++){
    fill(c[value[k]]);
    rect(i,100,80,80);
    i+=20;
    }
 




  fill(255,200,100);
  rect(0,100,200,80);

  if(d1==1){
    fill(128,128,128);
  }else{
    fill(255,0,0);
  }
  rect(60,400,80,80);
 
  if(d2==1){
    fill(128,128,128);
  }else{
    fill(0,255,0);
  }
  rect(360,400,80,80);
  if(d3==1){
    fill(128,128,128);
  }else{
    fill(0,0,255);
  }
  rect(260,400,80,80);
  if(d4==1){
    fill(128,128,128);
  }else{
    fill(255,255,255);
  }
  rect(160,400,80,80);
 
  if(val=='A'){
    d1=1;
    if(value[startt]==0){
      startt++;
      score+=10;
    }
  }
  else if(val=='S'){
 
    d2=1;if(value[startt]==1){
      startt++;
      score+=10;
    }
  }
  else if(val=='D'){
    d3=1;if(value[startt]==2)
    {  startt++;
    score+=10;
    }
  }else if(val=='F'){
    d4=1;if(value[startt]==3)   
     { startt++;
     score+=10;
     }
  }
  else if(val=='H'){
   d1=0;
  d2=0;
 d3=0;
d4=0;
  }
}
void keyPressed(){
  if(key=='4'){
    d1=1;
    if(value[startt]==0){
      startt++;
      score+=10;
    }
  }else if(key=='5'){
 
    d2=1;if(value[startt]==1){
      startt++;
      score+=10;
    }
  }else if(key=='r'){
    d3=1;if(value[startt]==2)
    {  startt++;
    score+=10;
    }
  }else if(key=='t'){
    d4=1;if(value[startt]==3)   
     { startt++;
     score+=10;
     }
  }
}
void keyReleased(){
  if(key=='4'){
    d1=0;
  }else if(key=='5'){
    d2=0;
  }else if(key=='r'){
    d3=0;
  }else if(key=='t'){
    d4=0;
  }
}


arduino:

int buttonPin5 = 5;
int buttonPin2 = 2;
int buttonPin3 = 3;
int buttonPin4 = 4;

int buttonState5 = 0; 
int buttonState2 = 0; 
int buttonState3 = 0; 
int buttonState4 = 0; 
void setup() {,tgy

  pinMode(buttonPin5, INPUT);    
  pinMode(buttonPin2, INPUT);    
  pinMode(buttonPin3, INPUT);     
  pinMode(buttonPin4, INPUT);
 
  Serial.begin(9600);

}
void loop() {
  buttonState5 = digitalRead(buttonPin5);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);
 
  if (buttonState5 == HIGH) {    
   //tone(8, 131, 300);
   Serial.write('A');
  } 
  else if (buttonState5 == LOW) {
   //Serial.write('Z');
  }
 
  if (buttonState2== HIGH) {    
   //tone(8, 147 , 300);
   Serial.print('S');
  }
  else if (buttonState2 == LOW) {
   //Serial.write('X');
  }

  if (buttonState3 == HIGH) {    
   //tone(8, 165 , 300);
   Serial.print('D');
  }
   else if (buttonState3 == LOW) {
   //Serial.write('C');
  }

  if (buttonState4 == HIGH) {    
   //tone(8, 175 , 300);
   Serial.print('F');
  }
   else if (buttonState4 == LOW) {
   //Serial.write('V');
  }
  if(buttonState2 == LOW&&buttonState3 == LOW&&buttonState4 == LOW&&buttonState5 == LOW){
  Serial.write('H');
  }
   delay(500);
}


心得:
在眾多的課程當中我覺得這是最需要創意且最有難度的一堂課,要會打程式要會麵包板還需要很多靈感來完成作品,而這堂課除了要感謝老師也要感謝助教、學長還有同學的幫忙,讓我們這組能順利的打完程式碼。雖然這堂課困難重重,但我又比別人多會了一樣的東西。

組員分工:
程式碼:朱席寬
電路板:林品妤
找題材:朱席寬
期末上台報告:林品妤

2012年11月27日 星期二

WEEK12,HW10




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(13, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(9, OUTPUT); 
  pinMode(7, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(1, OUTPUT); 
}
void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);   
  // turn the ledPin on
  digitalWrite(13, HIGH); 
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);         
  // turn the ledPin off:       
  digitalWrite(13, LOW);  
   digitalWrite(11, HIGH); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);   
  digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, HIGH); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);  
  digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, HIGH); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);  
  digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, HIGH); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);  
  digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, HIGH); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);  
  digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, HIGH); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);    
   digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, HIGH); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);   
  digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, HIGH); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);  
  digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, HIGH); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);  
  digitalWrite(13, LOW);  
   digitalWrite(11, LOW); 
    digitalWrite(9, HIGH); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);  
  digitalWrite(13, LOW);  
   digitalWrite(11, HIGH); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);  
  digitalWrite(13, HIGH);  
   digitalWrite(11, LOW); 
    digitalWrite(9, LOW); 
     digitalWrite(7, LOW); 
      digitalWrite(5, LOW); 
       digitalWrite(3, LOW); 
        digitalWrite(1, LOW); 
             
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);    
}

2012年11月13日 星期二

Midtern


int i,d1=0,d2=0,d3=0,d4=0;
int score=0, lastTime=60;
int[] value = new int[50000];
color[] c=new color[4];
int a,count=0;
int tmp=0;
int startt;

void setup(){
  size(500,600);
  c[0]=color(255,0,0);
  c[1]=color(0,255,0);
  c[2]=color(0,0,255);
  c[3]=color(255,255,255);
  for(i=0;i<10000;i++)
  {
    a=int(random(0,3.99));
    /*
    if(i%25==0)
      fill(255,0,0);
      else  if(i%30==0)
          fill(0,255,0);
          else  if(i%40==0)
              fill(0,0,255);
              else
              fill(255,255,255);
    */
    count%=50000;
    value[count++]=a;
  }
}
void draw(){
  background(255,200,100);
textSize(30);
fill(100,0,50);
text("Time:"+lastTime, 50,80);
text("Score:"+score, 0,220);
 if(lastTime==0){
      stop();
      textFont(createFont("3", 60));
      background(100,100,100);
      fill(255,255,255);
      text("Game Over ",120,250);
      text("Your score:"+score,0,350);
 }
lastTime=30-millis()/1000;

    i=200;
    for(int k=startt;k<startt+20;k++){
    fill(c[value[k]]);
    rect(i,100,80,80);
    i+=20;
    }
 




  fill(255,200,100);
  rect(0,100,200,80);

  if(d1==1){
    fill(128,128,128);
  }else{
    fill(255,0,0);
  }
  rect(160,400,80,80);
  if(d2==1){
    fill(128,128,128);
  }else{
    fill(0,255,0);
  }
  rect(280,400,80,80);
  if(d3==1){
    fill(128,128,128);
  }else{
    fill(0,0,255);
  }
  rect(160,500,80,80);
  if(d4==1){
    fill(128,128,128);
  }else{
    fill(255,255,255);
  }
  rect(280,500,80,80);
}
void keyPressed(){
  if(key=='4'){
    d1=1;
    if(value[startt]==0){
      startt++;
      score+=10;
    }
  }else if(key=='5'){
 
    d2=1;if(value[startt]==1){
      startt++;
      score+=10;
    }
  }else if(key=='r'){
    d3=1;if(value[startt]==2)
    {  startt++;
    score+=10;
    }
  }else if(key=='t'){
    d4=1;if(value[startt]==3)
     { startt++;
     score+=10;
     }
  }
}
void keyReleased(){
  if(key=='4'){
    d1=0;
  }else if(key=='5'){
    d2=0;
  }else if(key=='r'){
    d3=0;
  }else if(key=='t'){
    d4=0;
  }
}

遊戲開始:





















60秒後遊戲結束:






















2012年10月23日 星期二

WEEK,HW07

視訊圖案

WEEK07,HW07

int d1=0,d2=0,d3=0,d4=0;
void setup(){
  size(500,800);
}
void draw(){
  if(d1==1){
    fill(128,128,128);
  }else{
    fill(255,0,0);
  }
  rect(160,400,80,80); 
  if(d2==1){
    fill(128,128,128);
  }else{
    fill(0,255,0);
  }
  rect(280,400,80,80); 
  if(d3==1){
    fill(128,128,128);
  }else{
    fill(0,0,255);
  }
  rect(160,500,80,80); 
  if(d4==1){
    fill(128,128,128);
  }else{
    fill(255,255,255);
  }
  rect(280,500,80,80); 
}
void keyPressed(){
  if(key=='4'){
    d1=1;
  }else if(key=='5'){
    d2=1;
  }else if(key=='1'){
    d3=1;
  }else if(key=='2'){
    d4=1;
  }   
}
void keyReleased(){
  if(key=='4'){
    d1=0;
  }else if(key=='5'){
    d2=0;
  }else if(key=='1'){
    d3=0;
  }else if(key=='2'){
    d4=0;
  }   
}



做出四個顏色方塊,按下對應數字"4"(紅),"5"(綠),"1"(藍),"2"(白)會變成灰色 。
















2012年10月16日 星期二

WEEK06,HW06

1.
我覺得傅建國的期中作品"小朋友上樓梯"還不錯,讓我回想到以前很常玩,很懷念這遊戲:)很期待他們做出來我一定要去玩:D
還有
我覺得鍾毅軍的也不錯,"棒球遊戲",感覺很好玩,但感覺相對的難度也滿高的,也好期待他們做出來:D

2.
素材:顏色方塊*4,計時器,100個隨機顏色方塊以上我們打算直接用PROCESSING做出來,
背景音樂想選用比較刺激的配樂。
流程:剛進入遊戲畫面會有兩個選項 1.開始遊戲 2.背景音樂開關  按開始遊戲後就可以直接開始按相對應的方塊,上方有計時60秒的計時器,看大家在一分鐘能按對幾個顏色方塊

2012年10月9日 星期二

WEEK05,HW05

1.
void setup(){
  size(600,600);
}
  float say=0.01;
void draw(){
  background(500,200,200);
  translate(300,300);
 
  rotate(say);
  say+=0.01;
 
  fill(150,0,150);
  for(int i=0;i<20;i++){
    rotate( PI/10);
    ellipse(100,0,200,40);
  }
    fill(255,255,0);
  ellipse(0,0,100,100);
}

 
2.
void setup(){
  size(600,600);
}
  float say=0.01;
void draw(){
  background(500,200,200);
  translate(mouseX,mouseY);
 
  rotate(say);
  say+=0.01;
 
  fill(150,0,150);
  for(int i=0;i<20;i++){
    rotate( PI/10);
    ellipse(100,0,200,40);
  }
    fill(255,255,0);
  ellipse(0,0,100,100);
}
 
 
 
 
3.反應遊戲

 

2012年10月2日 星期二

WEEK04,HW04


void setup(){
  size(500,400);
  fill(255,0,0);
  rect(0,0,50,50);
  fill(0,255,0);
  rect(0,50,50,50);
  fill(0,0,0);
  rect(0,100,50,50);
  fill(255,255,255);
  rect(0,150,50,50);
  fill(255,255,255);
  rect(0,200,50,50);
  fill(0,0,0);
  rect(450,0,50,50);
  fill(0,0,0);
  rect(450,50,50,50);
}
int x=5;
void draw(){
  if(mousePressed && mouseX<50 && mouseY<50) stroke(255,0,0);
  else if(mousePressed && mouseX<50 && mouseY<100) stroke(0,255,0);
  else if(mousePressed && mouseX<50 && mouseY<150) stroke(0,0,0);
  else if(mousePressed && mouseX<50 && mouseY<200) save("a.png");
  else if(mousePressed && mouseX<50 && mouseY<250){
    PImage file = loadImage("a.png");
    image(file, 0,0,500,400);
  }
  else if(mousePressed && mouseX>450 && mouseY<50){
  strokeWeight(++x);
  }
  else if(mousePressed && mouseX>450 && mouseY<1000){
  strokeWeight(--x);
  if(x<2)x=2;
  }
  else if(mousePressed)  line(mouseX, mouseY, pmouseX, pmouseY);
}


2012年9月25日 星期二

week03,HW03

1.
void setup(){
  size(600,600);
}
int x=100,y=100;
void draw(){
  fill(255,0,255);
  rect(x,y,100,100);

  fill(255,255,0);
  ellipse(mouseX,mouseY,100,100);
 
  x=(x+mouseX)/2;
  y=(y+mouseY)/2;
}

2.

void setup(){
  size(800,800);
}
float x,y;
void draw(){
  background(0,0,0);

PImage girl;
girl=loadImage("C:/Documents and Settings/s513s/桌面/01.JPG");
image(girl,mouseX-240,mouseY);

PImage boy;
boy=loadImage("C:/Documents and Settings/s513s/桌面/02.JPG");
image(boy,x,y);

 x=x*0.75 + mouseX*0.25;
 y=y*0.75 + mouseY*0.25;
}

2012年9月17日 星期一

week02,HW02

1.
size(600,600);
for(int i=0;i<50;i++){
fill(random(255),random(255),random(255));
rect(random(500),random(500),random(500),random(500));
}


2.
size(400,300);
for(int i=0;i<40;i++){
  for(int k=0;k<30;k++){
fill(i*255/20,random(255),200);
rect(i*10,k*10,10,10);
}
}


3.
size(400,400);
for(int i=0;i<4;i++){
  for(int k=0;k<3;k++){
fill(random(255),k*255/30,100);
ellipse(i*100+50,k*100+50,100,60);
fill(50,5,50);
ellipse(i*100+50,k*100+50,60,60);
fill(random(255),random(255),random(255));
ellipse(i*100+50,k*100+50,15,15);
  }
}


4.
心得:
今天接觸了不一樣的東西,從來沒學過
但感覺跟之前學的電腦圖學有些類似
慢慢改慢慢完成圖
要很細心,但做出來滿開心的:D