kylewetton
Active member
I've built the Terrarium, and managed to get the Blink example working, environment all set up (this part isn't alien to me, i am a dev by trade).
I've also managed to control the LEDs with switches correctly and all seems to work okay in that area. You'll see it in the below script.
However, no sound at all, except for a very slight whistle when Switch 1 is on. I've checked all by parts and soldering and it's all there and accounted for.
So my question is, how do I go about debugging this?
One thing I should note is that I was successfully able to send an oscillator through output
Also, I was able to light up LED2 if it detected input?
I've also managed to control the LEDs with switches correctly and all seems to work okay in that area. You'll see it in the below script.
However, no sound at all, except for a very slight whistle when Switch 1 is on. I've checked all by parts and soldering and it's all there and accounted for.
So my question is, how do I go about debugging this?
One thing I should note is that I was successfully able to send an oscillator through output
Code:
for(size_t i = 0; i < size; i++) {
out[0][i] = osc.Process();
}
Also, I was able to light up LED2 if it detected input?
Code:
// if there is an input signal, light up led2
if (std::abs(in[0][i]) > threshold) {
dsy_gpio_write(&led2, true);
} else {
dsy_gpio_write(&led2, false);
}
C++:
#include "daisy_petal.h"
#include "daisysp.h"
#include "terrarium.h"
using namespace daisy;
using namespace daisysp;
using namespace terrarium;
DaisyPetal hw;
dsy_gpio led1;
dsy_gpio led2;
void AudioCallback(AudioHandle::InputBuffer in, AudioHandle::OutputBuffer out, size_t size)
{
hw.ProcessAllControls();
if (hw.switches[Terrarium::FOOTSWITCH_1].RisingEdge())
dsy_gpio_toggle(&led1);
if (hw.switches[Terrarium::FOOTSWITCH_2].RisingEdge())
dsy_gpio_toggle(&led2);
if (hw.switches[Terrarium::SWITCH_1].Pressed())
dsy_gpio_toggle(&led1);
if (hw.switches[Terrarium::SWITCH_2].Pressed())
dsy_gpio_toggle(&led2);
for(size_t i = 0; i < size; i++) {
out[0][i] = in[0][i];
}
}
int main(void)
{
hw.Init();
hw.SetAudioBlockSize(4); // number of samples handled per callback
hw.SetAudioSampleRate(SaiHandle::Config::SampleRate::SAI_48KHZ);
hw.StartAdc();
hw.StartAudio(AudioCallback);
led1.pin = hw.seed.GetPin(22);
led1.mode = DSY_GPIO_MODE_OUTPUT_PP;
led1.pull = DSY_GPIO_NOPULL;
dsy_gpio_init(&led1);
led2.pin = hw.seed.GetPin(23);
led2.mode = DSY_GPIO_MODE_OUTPUT_PP;
led2.pull = DSY_GPIO_NOPULL;
dsy_gpio_init(&led2);
while(1) {}
}
Last edited: