顯示具有 00160865胡凱翔 標籤的文章。 顯示所有文章
顯示具有 00160865胡凱翔 標籤的文章。 顯示所有文章

2014年1月12日 星期日

期末作品

一開始有倒數3秒開始遊戲的畫面
遊戲時間為30秒,左上角有倒數計時
黑色按鈕由左到右直接對照
電腦螢幕上由左到右的殭屍
藍色殭屍一隻為1分
超過50隻會出現紅色殭屍,一隻為2分
遊戲時間30秒結束後會進入顯示分數的畫面
遊戲結束。

2013年12月8日 星期日

期末專題

[1]想法:射飛鏢(預定!!)

飛鏢版結構
1.洞洞




2.磁鐵


需要做的道具:
飛鏢靶,飛鏢板

[2]想法:划船



需要用的道具:
划船槳

[3]想法:LED Cube


需要用的道具:
LED燈建模

2013年12月1日 星期日

13周

提醒同學們,明天12/2(一) 是我們互動技術概論第13週的上課。
(1) 請不要忘了帶 Arduino Starter Kit 的實驗設備到學校哦!
(2) 明大要上課的內容是 Project 05 06 07 哦! 同學們今晚可以預習一下。
(3) 我們上課的目的,是為了讓同學們在期末完成自己構思的創意作品,同學們可以邊上課邊思考哦!
(4) 明天同學們記得帶 9V 的方塊電池(25元-60元一顆), 還有找找家裡有沒有一些要用電池的廉價的玩具, 我們可以在學校享受動手改裝的樂趣!


project5
project6

//程式碼
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); } }

//影片


2013年11月24日 星期日

12周

1. Arduino Projects Book 的 Project 03 及 Project 04

http://www.youtube.com/watch?v=yeqHtqOKjFo

http://blog.arduino.cc/2013/07/30/arduino-starter-kit-video-tutorials/
http://forum.arduino.cc/index.php?PHPSESSID=2lv70v95kt2ic2lvqcbos9q9n3&board=86.0


http://quarknet.fnal.gov/fnal-uc/quarknet-summer-research/QNET2011/project_files/teacher_files/Getting_Started_with_Arduino.pdf
http://www.slideshare.net/GonzaloSantiago/arduino-26585969


十二月將邀請叁式曾煒傑創辦人來演講哦!
http://www.thefwa.com/site/heineken-pioneering-bar
http://www.ultracombos.com/blog/archives/2041
http://www.npm.gov.tw/zh-tw/Article.aspx?sNo=04005119


//程式碼
project3
const int sensorPin =A0;
const float baselineTemp = 20.0;

void setup(){
  Serial.begin(9600);
  for(int pinNumber = 2;pinNumber<5;pinNumber++){
    pinMode(pinNumber,OUTPUT);
    digitalWrite(pinNumber,LOW);
  }
}

void loop(){
  int sensorVal = analogRead(sensorPin);
  Serial.print("Sensor Value: ");
  Serial.print(sensorVal);
  float voltage = (sensorVal/1024.0)*5.0;
  Serial.print(" , Volts");
  Serial.print(voltage);
  Serial.print(" , degree C: ");
  float temperature = (voltage- .5)*100;
  Serial.println(temperature);
if(temperature<baselineTemp)
{
 digitalWrite(2,LOW);
 digitalWrite(3,LOW);
 digitalWrite(4,LOW);
}
else if(temperature>=baselineTemp+2 && temperature<baselineTemp+4)
{
   digitalWrite(2,HIGH);
   digitalWrite(3,LOW);
   digitalWrite(4,LOW);
}
else if(temperature>=baselineTemp+4 && temperature<baselineTemp+6)
{
   digitalWrite(2,HIGH);
   digitalWrite(3,HIGH);
   digitalWrite(4,LOW);
}
else if(temperature>=baselineTemp+6)
{
   digitalWrite(2,HIGH);
   digitalWrite(3,HIGH);
   digitalWrite(4,HIGH);
}
delay(1);
}


project4
const int greenLEDPin = 9;
const int redLEDPin = 11;
const int blueLEDPin = 10;
const int redSensorPin = A0;
const int greenSensorPin = A1;
const int blueSensorPin = A2;
int redValue = 0;
int greenValue = 0;
int blueValue = 0;
int redSensorValue = 0;
int greenSensorValue = 0;
int blueSensorValue = 0;
void setup(){
Serial.begin(9600);

pinMode(greenLEDPin,OUTPUT);
pinMode(redLEDPin,OUTPUT);
pinMode(blueLEDPin,OUTPUT);
}
void loop(){
redSensorValue = analogRead(redSensorPin);
delay(5);
greenSensorValue=analogRead(greenSensorPin);
delay(5);
blueSensorValue=analogRead(blueSensorPin);
Serial.print("Raw Sensor Values \t Red:");
Serial.print(redSensorValue);
Serial.print("\t Green:");
Serial.print(greenSensorValue);
Serial.print("\t Blue:");
Serial.print(blueSensorValue);
redValue=redSensorValue/800*255; ///將範圍值做修改讓顏色變化更明顯
greenValue=greenSensorValue/800*255;
blueValue=blueSensorValue/800*255;
Serial.print("\nMapped Sensor Values \t Red:");
Serial.print(redValue);
Serial.print("\t Green:");
Serial.print(greenValue);
Serial.print("\t Blue:");
Serial.print(blueValue);

analogWrite(redLEDPin,redValue);
analogWrite(greenLEDPin,greenValue);
analogWrite(blueLEDPin,blueValue);
}

2013年11月11日 星期一

crazy zombie shoot 其中作品展示!!!!


我們是製作手機小遊戲的zombie shoot改制做成電腦版並且延伸
遊戲規則
利用1-8鍵盤,按下最下排的zombie位置即可得1分,以此類推
如果你射殺的zombie超過50隻,就會變成紅色的zombie並且殺一隻提高為得2分
計時30秒,累計你射殺的zombie數,最後會統計得分於畫面
配合背景音樂,讓你隨著律動玩遊戲ㄏㄏ

因為此processing為太新版
所以顯示不出國字
舊版即可

程式碼:
import ddf.minim.*;
Minim m;
AudioPlayer player;
int []bz=new int[1000];
PImage imgZombie;
PImage imgRZombie;
PImage imgShoot;

void setup() {

  size(800, 600);
  imgZombie=loadImage("zombie.jpg");
  imgRZombie=loadImage("Rzombie.jpg");
  imgShoot=loadImage("shoot.jpg");
  for (int i=0;i<1000;i++) {
    bz[i]=int(random(8));
  }


  m = new Minim(this);  //
  player = m.loadFile("hww.mp3");
  player.play();  //播放背景音樂
}

int now=0;
int a;
int total=0;
int countDown=90;
int countDown2=1860;

void draw() {
  int a=0;
  if (a==0) {
    if (countDown>0) {     //倒數三秒準備開始遊戲
      background(70, 53, 1);
      countDown--;
      textSize(100);
      text(countDown/30+"秒", 350, 300);
      return;
    }
    a++;
  }
  background(70, 53, 1);
  if (a==1) {

    if (countDown2>0) {  //倒數30秒遊戲中
      countDown2--;
      textSize(50);
      text(countDown2/60+"秒", 20, 40);
      for (int i=now;i<now+5;i++) {
        if (now<=50)image(imgZombie, bz[i]*100, 400-(i-now)*100);
        if (now>50)image(imgRZombie, bz[i]*100, 400-(i-now)*100);
      }
      image(imgShoot, 0, 500);
      image(imgShoot, 100, 500);
      image(imgShoot, 200, 500);
      image(imgShoot, 300, 500);
      image(imgShoot, 400, 500);
      image(imgShoot, 500, 500);
      image(imgShoot, 600, 500);
      image(imgShoot, 700, 500);
    }
    a++;
  }
 
  if (a==2) {
    if (countDown2/60==0)text("哇!好棒"+total+"分", 300, 350);//結尾計分
  }
}

void keyPressed() {

  if (key==bz[now]+'1')
  {
    if (total<50)a=1;
    if (total==50)a=2;
    if (countDown2/60==0)a=0;
    now++;
    total=total+a;
  }
}