I made myself a spinner. Used the
mr.Spinner code. I was going to do this ages ago, but I managed to break my first arduino pro micro. Anyways, it was a pretty simple project. Two major components: the arduino pro micro and a rotary encoder. I got an arduino one:
Which is pretty low resolution (20 pulses per rotation), but also cheap and readily available. When you purchase it there's a little bump inside that makes it click while rotating which is undesirable, so I opened it up (unbend the bits of metal holding the top part on and then pull the knob off - a bit terrifying but again it's not an expensive part), flattened the bump, and put it back together and now it rotates smoothly. Didn't get any photos of that process because I did it ages ago before I broke the other board. There are five pins: CLK and DT are the rotary encoder signals (basically as you turn the knob they each alternate between 1 and 0 at different points, and the change between them tells the device you connect to how fast it's turning and in which direction. I think it goes 00-01-11-10 in one direction and 00-10-11-01 in the other, so if you know the previous state and the current state then you know which direction it's going). SW is the button - if you press on the knob it works as a button. VCC and GND are the current supply and ground.
Here are the connections to the pro micro. I did a pretty quick and dirty job on it. There are instructions on the github I linked to earlier, but basically you connect GND and VCC to GND and VCC on the board, the button goes to pin 6, and CLK and DT go to TX0 and RX1. Very sharp eyed readers might notice that the purple and blue wires have switched spots on the rotary encoder board - it wasn't obvious to me whether CLK went to TX0 and DT to RX1 or the other way around, so I took a guess and got it wrong, meaning when I tested the spinner it worked but backwards. You can't really tell which way I have it in this pic, so here's another:
So yeah: CLK goes to RX1, DT goes to TX0. Fortunately I'm using little pin to socket jumper leads, so while I've soldered on the pro micro the connections to the encoder could just be pulled off and switched. Now, as I predicted earlier in the thread:
once I get it working I’ll probably play arkanoid for about five minutes and then leave it alone.
It turns out even with a spinner I'm terrible at Arkanoid. Maybe if I had a higher resolution one I'd do better?
I may fiddle with this a bit more - install a socket rather than having a cable hanging out of the box, maybe some more buttons. For now though, it's working.