Prototype report: LEDs are Go! But sound is distorted.

A project log for Mechanical keypad for digital use

Adapting the keypad from a Soviet mechanical calculator (Быстрица-2) to generate digital signals.

thomasThomas 04/15/2020 at 17:050 Comments

I've finally got a prototype up and running using an ATmega. The LEDs are behaving well, but as you can hear in the video, the tones sound very garbled when responding to button pushes (they sounds fine in the power-on test sequence). I'm 95% percent sure I know what's happening: the unit is scanning many times per second to see if a button is engaged. When a button IS engaged, it's playing that tone many times a second, which leads to audio distortion. The solution lies in the code, which is my weak area. I'm fairly certain the solution involves proper use of buttonState.