button_debounce_and_critical_mistake

Currently our installation can detect if you are sitting in front of it and start the drums of the tracks selected, it will register if you touch one of the conductive points and will play a different instrument from the tracks (e.g vocals, guitar, bass, synth, …).

The only thing left in terms of basic usage plan and functionality is for the user to be able to select a song. My plan for this part was to use the remaining ports of the capacitive sensor. The problem here is that once I translated the mpr121 values to toggle values it does this for all 12 ports it has. So for me it was not possible to make the work with this, because with the currently existing code we had was not working properly with the toggle values of either “1” or “0” depending on the touch of the user. What was required was a button that once pressed would send a single value of “1”. This would trigger the song we want only once and not multiple times as compare to that the toggle code was doing.

The solution was to put 5 new buttons for changing the sound, but while testing them I noticed I am not receiving a stable value of “1” when I press the button. Instead of this the value was jumping between the two constantly ans seemingly without any reason. I sent a whole two days in researching different ways for debouncing a button as I knew from last year that in order to miss bouncing values I have to use a button debounce. A lot of examples were available online but none was suitable or seemed to not work out. This issue came at quite the critical moment and almost made me in odds with the teachers as I was tring to explain myself and my problems and they seemed to explain to me what to do in a completely different situation.

In the end, I remembered that an error could not only be in the software, but might accure also in the hardware. I made a check on how all the mounting was made on the breadboard with Rene and apparently I had a big mistake from the beginning and I had switched the placement of two cables and this resulted in giving me completely wrong results.

Leave a comment

Create a free website or blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started