Tim Cameron Ryan
Computer stuff maker from Boston, Massachusetts.
Student at Olin College of Engineering.
See the projects I've been working on.
Or view my resume.
-
Controlling your mouse using an iPad and HTML5
A friend recently showed me the JazzMutant Lemur, a swank multitouch audio controller for synthesizers, and asked how he might duplicate its functionality with an iPad. Though it would definitely be possible in Objective-C, I told him the quickest way to get started would be to make an HTML5 app. To demonstrate, I made a full-screen mouse controller on the iPad, which connects to a Python server on a computer using WebSockets.
What you’ll need for iMousePad:
- A Linux installation
- An iPad (iOS 4.2+)
- Both to be connected to the same network.
First, our HTML interface. It prompts for a computer to connect to, receives the screen geometry, and then sends touch input to the server. It allows you to move the mouse and perform button clicks:
This Python WebSockets server is minimal: a single file using the raw socket API, with no dependencies. It’s not very robust but it works well for this example:
Launch the Python server locally. (You may need to do it as root.) Then navigateto the HTML page on your iPad. Type in your computer’s
hostnameand wait for it to connect. Simple!Aside: Ultimately, our school’s Wi-Fi network was too slow to send input without lag, which, when you’re mixing music in realtime, might be crucial. I next attempted to (ab)use the HTML5
<audio>element to make an audio cable a direct wire between the iPad and my computer’s microphone input. Six hours later, I had achieved a mere 3 bytes/second and a much greater appreciation for how difficult Quicktime is to work with.Next, I’ll explore how to abuse the <marquee> tag to control your toaster.
Github
@timcameronryan
LinkedIn
Email me