顯示具有 00160236李翌琦 標籤的文章。 顯示所有文章
顯示具有 00160236李翌琦 標籤的文章。 顯示所有文章

2014年1月12日 星期日

期末作業

遊戲玩介紹:

1.

遊戲機台

2.


總共有9個孔可以戳

3.
若是遊戲輸了LED燈會亮起來,吶喊也會轉動

4.

將刀子戳下去

5.
 
若戳中錯誤的孔,LED燈即亮起來,吶喊也會轉動

6.


將海盜旗插下去可以重新開始遊戲
7.
遊戲內部接線

8.
遊戲道具與遊戲機台

8.影片介紹:






2013年12月8日 星期日

第十四週上課作業

1.植物大戰豬豬,我們決定採用3個按鈕控制一個植物,方別為往上、往下與射擊,小豬在幾行裡隨機出現,我們按按鍵來移動植物,並發射子弹

2013年12月1日 星期日

第十三週上課作業

1.旋轉馬達:
#include <Servo.h>
Servo myServo;
int const potPin = A0;
int potVal;
int angle;
void setup(){
 myServo.attach(9);
 Serial.begin(9600);
}
void loop() {
  potVal = analogRead(potPin);
  Serial.print("potVal:");
  Serial.print(potVal);
  angle = map(potVal, 0 , 1023 , 0 , 179);
  Serial.print(" , angle :");
  Serial.println(angle);
  myServo.write(angle);
  delay(15);
}




2.發出平率:
int sensorValue;
int sensorHigh=0;
int sensorLow=1023;

const int ledPin=23;
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,40000);
tone(8,pitch,440);
delay(10);
}




3. DO RE MI 聲
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);
 }
}

第十三 週上課作業

一, 旋轉馬達

#include <Servo.h>
Servo myServo;
int const potPin = A0;
int potVal;
int angle;
void setup(){
 myServo.attach(9);
 Serial.begin(9600);
}
void loop() {
  potVal = analogRead(potPin);
  Serial.print("potVal:");
  Serial.print(potVal);
  angle = map(potVal, 0 , 1023 , 0 , 179);
  Serial.print(" , angle :");
  Serial.println(angle);
  myServo.write(angle);
  delay(15);
}




二, 發出音頻

int sensorValue;
int sensorHigh=0;
int sensorLow=1023;const int ledPin=23;
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,40000);
tone(8,pitch,440);
delay(10);
}




三, 發出 Do Re Mi

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日 星期日

第十二週上課內容

chapter 04
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 Value \t Red: ");
  Serial.print(redSensorValue);
  Serial.print("\t Green: ");
  Serial.print(greenSensorValue);
  Serial.print("\t Blue: ");
  Serial.print(blueSensorValue);
  redValue = redSensorValue/4;
  greenValue = greenSensorValue/4;
  blueValue = blueSensorValue/4;
  
  Serial.print("Mapp Sensor Value \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);
}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 Value \t Red: ");
  Serial.print(redSensorValue);
  Serial.print("\t Green: ");
  Serial.print(greenSensorValue);
  Serial.print("\t Blue: ");
  Serial.print(blueSensorValue);
  redValue = redSensorValue/4;
  greenValue = greenSensorValue/4;
  blueValue = blueSensorValue/4;
  
  Serial.print("Mapp Sensor Value \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);
}

影片





第十二週上課練習

1.LESSON3 溫度感應
程式碼:
const int sensorPin =A0;
const float baselineTemp=26.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(", degress 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);
}
成果發表:


2013年11月17日 星期日

第十一週上課內容


1. 練習第一個範例 File-Examples-Basic-Blink



影片


2. 修改程式,變成展得比較特別的作法


     一顆燈泡閃爍

影片 coming  soon



   三顆燈泡閃爍
 

影片 coming  soon

2013年11月10日 星期日

李翌琦、李惠筠 期中作業

期中作品

植物打豬豬




李惠筠、李翌琦 期中作業

1.遊戲玩法:
從上到下共六個子彈通道,分別代表鍵盤,A、S、D、J、K、L (大小寫都可),
目標是打隨機出現的小豬,打到一隻算一分,如果小豬到底線,及遊戲結束

2.遊戲畫面:

2013年10月20日 星期日

第七週上課內容

1. 請列出你今天三個小時,要完成的事

隨機雞蛋和垃圾落下的速度及位置

2. 你在期中作品要做到什麼程度

遊戲順暢進行,遊戲架構完善


3. Why? 你為什麼要做它

喜愛的小遊戲之一,想要自己完成執行它

2013年10月14日 星期一

2013年10月6日 星期日

第五週上課內容

1.畫花瓣 旋轉











2.用迴圈來畫花瓣











3.滑鼠移動顏色改變,同一點點擊較久會多重花瓣











4.花多重旋轉














5.點擊可畫花瓣並旋轉














期中想做的遊戲


















心得&目標
這堂課很多收穫也是最充實的課,當下可能理解程度不是完全,但還算可以消化。目標是以敲鞋跟為出發點不單只是用滑鼠玩,希望能透過實體元件達到更多樂趣。

2013年9月29日 星期日

第四週上課內容

顏色固定的筆















可換顏色




















增加調色盤
















筆線加粗












改游標
















本週心得:
上學期有用DEV C++寫出小畫家功能,但只是陽春的一些功能,而且顏色都是制定的,這次學到小畫家很開心,寫出理想中的樣子。

2013年9月22日 星期日

第三週上課內容

1.畫棋盤背景線條



















1.1. 使用 Tool- Color Selector, 挑出你要的顏色, 可用 R,G,B 來描述,也可用 #0B33FF 之類的像亂碼的數字來設定顏色
1.2. 要畫外框,可以用 rect()來畫, 要修改填充的顏色可以用fill(), 要讓畫的內部不要填充, 可以查看 Help-Reference 後,在 fill()樓上樓下相關的地方找到你要的功能 (ex. noFill() )
1.3. 使用 stroke() 來調畫線stroke的顏色, 在 Help-Reference 裡面可以找 stroke 相關的功能,像是比較粗的 stroke 可以用 strokeWeight() 來設定權重粗細

2.滑鼠移動

1. Google 美女工程師, 程式語言用 Ruby, C++, Processing 
1.1. TODO: 請去找一下 Processing 寫出來的作品 
1.2. TODO: 用 Youtube 分享,按Blogger 把 HTML的 <iframe...> 貼在你的作業中
1.3. 下載 Processing 
2. TODO: 寫出你的第一個Processing 程式碼: Hello World 變 Hello Kitty
3. TODO: 請找一張圖,用小畫家(mspaint)輔佐你,畫出你的 Processing 圖, 並都貼出來。
4. TODO: 請寫下你的心得 (1) 你學了什麼東西, (2) 有什麼東西不懂, (3) , 還想學什麼


本週心得:
很開心接觸到這門課,今天學到畫棋盤和完成下棋的動作。

貼你覺得有意思的影片, 使用youtube 的分享, Blogger 分享, 兩邊都改成 HTML, 貼上 
HTML 




2013年9月15日 星期日

第二週上課內容

1. Processing 啟動, 有問題的同學請再下載download
http://processing.org

2.  for迴圈














3. 試用 Processing-Help-Reference
3.1. 找 rect() 函式
3.2. 看看 rect() 樓上樓下的相關函式, 並嘗試畫出和老師不同的圖

4. 那想要改變顏色呢?
4.1. fill() 是填充的顏色, stroke()是筆的顏色
4.2. 透明的顏色(alpha),其實也是顏色(color)



















5. 加一點點滑鼠的互動吧! 可以使用 mouseX 及 mouseY 的值,來進行色彩繽紛的運算



















6. 亂數 random(數字上界) 來設定初始的亂數值 [課堂作業3] 利用mouseX,mouseY,random()做設計

2013年9月8日 星期日

第一週上課內容

0. 課程準備
0.1. 加入 課程FB社團
0.2. Google文件 填寫修課資料 (學號姓名,email,電話)
0.3. 加入 Blog, 設定

編交作業方式: tag: 000葉正聖老師, Week01, 00160011葉大明
逗號隔開, 學號姓名間不要有空格

processing
 600x600的視窗






 黃色背景







在100,100,200,200點畫四邊形












老師做的 Angry Birds Brick
http://www.cmlab.csie.ntu.edu.tw/~jsyeh/processing/angryBirdsBrick/












貼圖
PImage imgBird=loadImage("http://www.cmlab.csie.ntu.edu.tw/~jsyeh/processing/angryBirdsBrick/bird.png");
PImage imgPig=loadImage("http://www.cmlab.csie.ntu.edu.tw/~jsyeh/processing/angryBirdsBrick/pig.gif");
image(imgBird, 0,0);
image(imgPig, 100,100);

游標與鳥置中且圖片不會暫留在背景










PImage imgBird, imgPig;

void setup() {
  size(600, 600);
  imgBird=loadImage("http://www.cmlab.csie.ntu.edu.tw/~jsyeh/processing/angryBirdsBrick/bird.png");
  imgPig =loadImage("http://www.cmlab.csie.ntu.edu.tw/~jsyeh/processing/angryBirdsBrick/pig.gif");
  imageMode(CENTER);
}

void draw() {
  background(255, 0, 0);
  image(imgBird, mouseX, mouseY);
  image(imgPig, 200, 200, 100, 100);
}
coursera class
https://class.coursera.org/digitalmedia-001/lecture/index