Hi! I’ve been following this tutorial: Cd4051 Multiplexer Tutorial Is Here!
I’ve got a single multiplexer working great, but adding a second one hasn’t worked so far. I can use either one or the other, but trying to use both crashes the Seed. Here’s my code, adapted from that tutorial:
#include "daisy_seed.h"
using namespace daisy;
DaisySeed hw;
int main(void)
{
hw.Init();
AdcChannelConfig adc_cfg;
adc_cfg.InitMux(seed::A0, 8, seed::D0, seed::D1, seed::D2);
adc_cfg.InitMux(seed::A1, 8, seed::D3, seed::D4, seed::D5);
hw.adc.Init(&adc_cfg, 2); // crashes
hw.adc.Start();
hw.StartLog();
while(1)
{
System::Delay(250);
hw.Print("Input 1: %d", hw.adc.GetMux(0, 0));
hw.Print(" ");
hw.Print("Input 2: %d", hw.adc.GetMux(0, 1));
hw.Print(" ");
hw.Print("Input 3: %d", hw.adc.GetMux(0, 2));
hw.Print(" ");
hw.Print("Input 4: %d", hw.adc.GetMux(0, 3));
hw.Print(" ");
hw.Print("Input 5: %d", hw.adc.GetMux(0, 4));
hw.Print(" ");
hw.Print("Input 6: %d", hw.adc.GetMux(0, 5));
hw.Print(" ");
hw.Print("Input 7: %d", hw.adc.GetMux(0, 6));
hw.Print(" ");
hw.PrintLine("Input 8: %d", hw.adc.GetMux(0, 7));
}
}
This line consistently crashes the Seed and I can’t figure out why:
hw.adc.Init(&adc_cfg, 2);
Would love some tips! Thanks!