Playaround 第一天課程

第一天
瞧! 這就是 Microcontroller
Hi, Micro, 你真行!
有用資料, 好讀
Physical Computing?!
與Arduino玩耍
數位玩家: 首次與Arduino玩耍, 傻瓜LED
來點激動的:立即試: 啓動家電!
|
Wikipedia: Microcontrollers are frequently used in automatically controlled products and devices, such as automobile engine control systems, remote controls, office machines, appliances, power tools, and toys. By reducing the size, cost, and power consumption compared to a design using a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to electronically control many more processes." 還是不知道他在說甚麼鬼話. 簡單點來說, 就是一部超級小型的電腦. 有簡單的輸入輸出功能, 有很小的記憶, 就這樣. 你可以給microcontroller編寫程式, 讓他做一些工作. 我們在這個工作坊裡會用一款名叫Arduino的microcontroller (是開放源碼的microcontroller!) 來做點好玩的. 你大概會利用得讀取感應器的數據, 然後在電腦或microcontroller本身作出相對的反應. 你也可以控制硬件如馬達, LED等等. |
|||||||||||
|
那麼, microcontroller或者Arduino究竟能做個甚麼好玩出來? 瘋狂的演繹
【予告編】土佐信道(明和電機)監督作品『バカロボ2007』
一些利用Arduino作的有趣作品:
Moving Mario!!!!!!!!!! by theDemos
Chatter and Listening
Customer designs with their fists
Light Installation
lighting, by todbot
midi drum , by todbot 有人做過:
LCD
Ciruit Bending
NDS
Thermin
我學生的科目作品:
by Ashley
by Jason 稍後有更多的~ |
|||||||||||
|
有用資料: |
|||||||||||
|
好讀:
|
|||||||||||
|
節錄雨娃老師的厲害文字: "要上 Physical Computing 課程,是否要懂物理學? "為什麼一定要用 Arduino 不可? "什麼又是感應器(sensor)? "有沒有這麼累一定要寫程式? |
|||||||||||
|
現在來輕輕的介紹Arduino
(Information from http://www.auduino.cc) There are different version of Arduino. The one we are using made with Atmel ATmega8 ( datasheet ).
(Information from http://www.auduino.cc)
USB boards with the new FTDI232R usb interface Serial board that has a USB port to communicate with a computer
(image source from http://www.auduino.cc) It’s a basic board that uses RS232 as an interface to a computer for programming or communication. This is a miniature Arduino board with a tiny processor that has twice the memory of the one on normal Arduino boards. Can only be powered with up to 9 volts; don’t give it any more voltage or plug it in backwards – it’ll die. You can make you own Arduino: Prototype Shield
(image source from http://www.sparkfun.com) Also, you can make one by yourself with low cost:
1) http://www.tigoe.net/pcomp/code/archives/arduino/000729.shtml (you can even download the eagle file to develop the shield)
(image source from http://todbot.com)
Different type of Shield
來! 來最愚蠢的測試! We have Hello World as our first try in programming. In microcontroller, we have no Hello World, instead, we have blinking LED (閃亮 LED). Put your LED into Pin 13 and GND, Arduino has already 1K resistor in pin 13! Program the Arduino As mentioned before, Arduino is a USB Serial Port, its communication port is COM port. If you work it out at home, find the com port out in the device manager.
Now select the serial port we are going to use
This is the driver we have setup in the computer in the lab before. The drive is FTDI. Now, write you program in Arduino IDE and upload it to the board. The following is the program
Upload it to Arduino
閃亮 LED! |
|||||||||||
|
先來了解數位是甚麼:
簡單來說, 以你們剛剛看到的LED來做說明: LED只有亮和不亮, 沒有半亮. (當然稍後你能把它變半亮) 然後, 剛剛的測試….對! 你跟本不知道自己在做甚麼 來看看那堆怪獸碼在幹甚麼
來逐一了解:
The Blinking exercise is just simply light up the LED by sending HIGH to the pin, and off by sending LOW to the pin. In between, there is a code delay(1000).
You can also find pinMode in the code
自己來: 你能否改變他們閃的速度? |
|||||||||||
|
加入數位輸入 剛剛的就只有輸出, 哪有互動的份兒. 正如之前解釋何謂數位: 只有全開和不開. 現在我們就試試如何讀取開關按鈕的狀態. 有兩個加開關按鈕的方法: Positive Logic
Inverted Logic
兩個接駁方法很不同啊. 其實開關按鈕最後只是決定讓不讓電流通過. 正常來說, 按下去就是讓電流通過, 即我們平常的開燈. 放手就是不讓電流通過, 即是關燈. 上面Positive Logic, 看其名就知道是"正常". 所以若跟據這個圖:
有電流時應該是HIGH, 即1. 所以如果我們讀取開關按鈕時得到 1 (在positive logic上), 即是說開關按鈕被按下. 如果讀得是 0, 即開關按鈕沒有被按下.
但是, 程式怎樣編:
好問題一條: 為什麼連LED到13 pin時不用電阻, 其他的要? 基本上如果我們透過digitalWrite給電時, 電會超過3V. 但一顆超普通的LED絕對不能承受3V的電流量. 於是我們就要加上電阻, 讓電流減低. 除了PIN 13本身內置220ohm電阻外, 其他pin是沒有的.
|
|||||||||||
|
小玩意: tilt switch 這個tilt switch的原理跟開關按鈕是一樣的, 只是它不是按鈕. 給你一點時間, 用同樣的程式, 但換上不同的按鈕, 試試效果變成怎樣
|
|||||||||||
|
太悶了吧! 就是知道學習phsyical computing的開頭有夠悶. 但, 怎樣去透過Arduino控制或只不過是啓動家電? 當然, 我不會在你們的第一天就來得這麼激動. Relay box: 繼電箱 好的, 先來給你們看看video
帥! 這次輪你們! 原理是超簡單: 還記得之前我們我們玩LED時, 我們想亮LED的時候就是作這個 digitalWrite(ledPin1, HIGH) 然後連到 ledPin1的led就會亮起來. 這個我自家製的繼電箱有兩根線, 原理正正跟要亮起 led 一樣: 如果你給他HIGH, 繼電箱就讓電流流通, 否則就不流. 究竟, 你可以用這個繼電器做甚麼? 來用你的創意吧! (如果只利用今天學過的, 可否變成一台要不停按鈕才能充電的充電台?!!!!) |
|||||||||||

















[...] http://www.the-demos.com/playground-day1/ [...]
[...] and me work together as mentor in this workshop. I am handling one of the workshop which is about Physical Computing with [...]
Leave your response!
Recent Moves
Recent Comments
Links