Need help storing last button press please

Status
Not open for further replies.

skamgdi

New member
hello every one,

I am new here && new to coding && need some help lol. i have 3 buttons that i want to store currentButton and LastButton but i am having some trouble with this using the bounce.h library.
can anyone please let me know the best way to attack this? I have attached my code please have a look. also my main goal is to control the filter of each button and store that filter value so when i press another button i can edit the new button without changing the first.
 

Attachments

  • Drums_with_filter.ino
    9.7 KB · Views: 108
Last edited:
Your code looks like it will rapidly & repeatedly reprogram the filters and mixers every time loop runs.

Code:
  if (currentbutton == 0)
  {

    // quick and dirty equation for exp scale frequency adjust
    float b0freq =  expf((float)freqknob / 150.0) * 10.0 + 80.0;

    b0filterstore = freqknob;
    filter1.frequency(b0filterstore);
    filter2.frequency(b0filterstore);

You probably only want to change this stuff when the button is actually pressed. So it should probably go inside the if checks for fallingEdge.
 
Status
Not open for further replies.
Back
Top