I bought Graphics LCD (KS0107). So I tried to control this GLCD with iPod touch/Safari through WebSocket.
For controlling GLCD, I used Arduino and KS0108 library. Firstly I wrote the Arduino code that Arduino receives a drawing data from serial port and draws a picture on GLCD.
A drawing data is sequences of lines constructed of start and end point. For example, if there is a drawing data: "10,10:20,20;20,20:30,10;", this data means that the first line connects (10,10) and (20,20) and the second line connects (20,20) and (30,10).
Secondly I wrote the WebSocket Server in Python/Tornado. This server receives a drawing data from iPod touch/Safari through WebSocket connection and sends the data to Arduino thought Serial port. I used pySerial for Serial communication.
Finally I wrote a web page for drawing a picture and sending a drawing data. This page uses Canvas and WebSocket and is written in HTML5. This page can be loaded and used on iOS Safari or Google Chrome.
On iOS Safari, the pen is my finger or touch pen. On Google Chrome, the pen is mouse cursor. For reducing the size of data, I thin out points of pen's motion.
I used it and made expository movie.
I wanted to draw some amusing picture but I don't have a talent for painting.
Thanks.

No need for arduino.open() in the server side code. It will cast an exception telling you that the port is already open.
ReplyDeleteThank you for this article. It has helped me a lot :)