Hi there, first post here…
I’ve just started dabbling with writing firmwares for the Versio using libdaisy and run into an issue:
I can’t seem to detect any presses on the momentary switch (Tap/FSU/Hit etc.) of my versio unit.
hw.SwitchPressed()
doesn’t catch anything and stays ‘false’ all the time. The corresponding CV input (Gate) is working fine, though. I can also get the button to work using oopsy and gen~, so it’s not a hardware issue.
Here’s some code for testing:
#include "daisy_versio.h"
using namespace daisy;
DaisyVersio hw;
int main(void)
{
hw.Init();
hw.seed.StartLog(true);
while(1) {
// this doesn't work...
if (hw.SwitchPressed() )
hw.seed.PrintLine("pressed!");
else
hw.seed.PrintLine("not pressed!");
// this works fine
if (hw.Gate() )
hw.seed.PrintLine("Gate HIGH!");
System::Delay(100);
}
}
thanks @maasijam , that was spot on. It’s working fine now!
I would have expected the SwitchPressed() function to do the debouncing for me in the background, but ok, it’s easy enough to put that line in myself.
Thanks again.
There might be a couple of things to check regarding the switch detection. First, ensure that you’ve correctly configured the switch in your setup. Sometimes, switches need to be initialized or configured explicitly before they can be used in the main loop. Additionally, make sure that the switch is properly debounced; rapid presses might be missed if not handled correctly. You might also want to confirm that you’re using the right function for the switch state. If you haven’t already, check the documentation for any specifics on how the SwitchPressed() function works. Lastly, ensure that your firmware is up to date, as bugs or issues in older versions might affect functionality. If all else fails, consider reaching out to the libdaisy community for more targeted assistance!