Networked Objects - Pong game
小改當中幾行analog in/digital in(聽了去年修課的Josh兄建議, 決定採取比較不會出槌的digital switch)
只是用了簡單的(地上撿到的垃圾)小木塊, 挖洞, switch擠進去, wires拉出來, hook up到breadboard上, 大功告成!
操控方法(1): 狠焦慮地拿木塊不斷敲桌面, 敲左面-->paddle往左跑, 敲右面-->paddle往右跑
操控方法(2): 把小木塊輕巧地拿起置於鼻樑, 下巴中間, 利用左右兩手食指靈巧地壓左右兩面switch, 如同發呆雙手脫住下巴的無聊小gesture舉動
Bascially we are using the same code from Tom. The only thing we have to deal with is a small change of analog/digital input. I chose the digital instead of analog input due to some suggestion form Josh who took this class in the last semester. From his saying, digital input could get more stable and continuous move of your pong paddle than analog (Actually it depends on how you write your code). Though getting a big help from Josh, I still struggled with the never-expectable hardware part. At the beginning, the signal only appeared on the serial monitor but terimanl. It took me a while to figure out that I shouldn't have hooked up the Xport's RX and TX to FT232R's TX and RX. Instead, they should go to arduino's TX and RX since FT232R in my circuit only did a job of providing 3.3V power and did nothing about transferrinf/receiving data. What a silly mistake!
Here is the circuit i got:
The physical interface: a small block with 2 switches locate seperately inlayed into its right and left surfaces.
Playing with the block:
This video shows all steps of logging in/out the pong game server. Instead of really receiving/transferring data from/to the server, I fake it by typing comments in Terminal for a rehearsal test. 'C' means that the server sends a connection signal through Xport to arduino (in real playing, the connection is automatically made once i plug the Ethernet cable into Xport), and then I press a connect button on my breadboard to start the game. Several lines of 'C188.8.131.52/8080' instantly jumps up. Next step is to simulate the control of pong paddle. Pressing right button (R side of the block facing down) appears 'r' on Terminal screen while left button shows 'l'. Once I press the connection button again, I lose the connection and 'x' jumps out, which means sending a signal to ask the server to quit. DONE!
m/photos/78guy/sets/72157594550362170/">Guy's flickr and Mike's flickr.