Getting the button state on a Patch SM
I have a ready made Patch Init module (this one: patch.Init() - Daisy) and I’m trying to get the state of the push button in my code and then light up the test LED on the board..
As I see it the full code should be
#include "daisy_patch_sm.h"
#include "daisysp.h"
using namespace daisy;
using namespace patch_sm;
using namespace daisysp;
DaisyPatchSM hw;
int main(void)
{
hw.Init();
Switch button;
button.Init(DaisyPatchSM::B7, hw.AudioCallbackRate());
while(1) {
bool button_state = button.Pressed();
hw.SetLed(button_state);
}
}
but the state is always false. What am I doing wrong?
I ran the Blink example code just fine, so my toolchain setup and hardware seems to be working properly.
Thanks in advance,
Sebastian