Work Log

So tonight I went to London Hackspace, and as well as drinking beer and chatting, and suchlike, I worked on this headband project. You know, one of the two that I promised myself I'd finish, but the one that doesn't yet grind painfully at my soul.

The plan of attack is to get Unity talking to the Arduino board. The sensor reading isn't going to be used, so all I have to do is set some pins to output PWM (and no maxbotic setup logic to worry about!). As it happens, the bodged together protocol I wrote lets you read but not yet write. But anyway it's shonky, and standards are awesome, so lets rip it out and replace it. So now the Arduino board is running Firmata. Firmata has it's own protocol that I'm not particularly enthusiastic about writing, so I found Firmata.NET, a class for talking it in .NET.

(Although! First, I banged my head getting serproxy working. Serproxy lets you read and write TCP and have it come out through a serial port. Useful if you wanna use Flash, although a better solution is to not. Turns out the configuration file was slightly more magical than I expected, and there was no readme bundled to tell me that net_port7, for example, meant com7, not the 7th port I told it about. Also, I had to find a patched version for it to talk to com10 and above. Given on my PC anything lower than com11 is reserved... also, I had to fuck about getting telnet to work on Windows. The Windows CLI - eternally unloved. Anyway, it worked, and I was about to write some ugly Arduino code to read rotation vals when I decided to abandon all that and do it all in Unity with someone else's protocol and C code, ie Firmata.)

So I managed to get Unity to accept Firmata.NET and import (it's not import in C#, it's something else) it from an actual game object. But not open a connection to COM11. After some fiddling with opening it myself using, I concluded* that COM11 wasn't going to work. Reshuffle my serial ports in device manager, and hey presto! I can now reliably crash Unity!

Writing up these notes it occurs to me that window's warning that another program is bound into COM5 may be a clue. Anyway, at this point I stopped.

Next time! I guess either I fix my ports up good, or return to serproxy. I wonder if I'll ever get the GPS my laptop supposedly has working. It's just sitting there on sweet sweet COM6...

After that, I make Unity do sensible encapsulated vibratey things, hook it up to raycasters, mount them on a first person controller. And make a game/world to wander through.

*read on the internet.

19 October 2010