Sunday, February 6, 2011

Surprises from the Arduino

As an expansion to the organ project I've been working on I bought a rotary encoder. Of course I got it surplus, and it came without any data. So yesterday I hooked it up to my Arduino to see if I could make some sense of what it did. After about 10 minutes of bread boarding, and 10 writing a sketch (well modifying one of the examples) I had a thing. On reset it would play a constant tone - if I twised the encoder one direction the tone would get lower, the other way it would get higher - cool.

The surprise came because I didn't put any limit checking into the code prior to the call to tone() - hence, when twisting the encoder brought the pitch down to zero - or into the negative numbers - I got some really interesting results. Give a listen.