Hi there,
I was hoping someone might be able to please sign me in as a guest for electronics night for some help with a project I’m building. (I’ve only been to an open evening)
I’m trying to build a keyboard where each note is determined by how much light gets into a light sensitive resistor.
The code is quite hacky but it works… well… “works”
- with one button the note changes cleanly according to how much light gets into the resistor (works for either button)
- if I push the code for both buttons the notes do change according to how much light gets into the resistor. However, the sound is warped and there seems to be a delay?
I tried poking around on some forums but with no luck - the main suggestion was to add a capacitor to the piezo but all this has done is reduce the volume. Someone else suggested refactoring it to use a PWM output for tone output and button detection by interrupts. I’m going to look into this a bit more before Wednesday.
I’m reluctant to play around with this too much because I’m worried I’ll fry something accidentally. I don’t necessarily need to fix this - I just want to understand what I should research next and why the sound is coming out like this.
If this sounds like something someone could be interested in please let me know!
github: https://github.com/Hanmack101/keyboardThermin/blob/master/chirrup
Setup is two buttons connected via power and a resistor, a piezo and a light sensitive resistor.