I recently acquired a rotary encoder to use as an input device for my hardware project. Knowing that such encoders make use of Gray code, I cracked open my Digital Design textbook and began coding a sketch for my Arduino. It wasn't as straightforward as I had hoped.
Showing posts with label hacking. Show all posts
Showing posts with label hacking. Show all posts
Thursday, March 31, 2011
Monday, March 14, 2011
Splitting a Path to a list in Python
At work today I needed to split a file path into it's various directory and subdirectory components using Python. While the result of os.path.split can be inversed with os.path.join, they don't do what you might intuitively think they do. A cursory search on Google, while turning up various and sometimes overbuilt solutions, didn't give me a quick and dirty function to accomplish this task, so I wrote one myself.
Monday, February 28, 2011
AnyPWM Revisited
In my original post, I presented an Arduino sketch that could output PWM on any digital pin. It occurred to me spontaneously that the code was horribly inefficient, both in size and execution. So I've refactored the code a bit, and now it appears to work at least as well as the built in PWM functions.
Saturday, February 26, 2011
PWM on Any Digital Pin on Arduino
I recently got an Arduino to play around with. It's been a few years since I've done some electronics hacking, and I wanted to get back into the hobby. There are tons of low cost embedded microcontrollers to play with these days, compared to when I was back in college, so I decided to give the Arduino a try. My first experiment was to emit PWM signals on any of the digital output pins.
Subscribe to:
Posts (Atom)