ADC Reading

Hello!

Absolutely LOVING the Daisy and everything around it, i’m just moving on from the basic examples on the seed and just wondering how I read multiple pot inputs? I’ve defaulted to just using the petals firmware and using the Parameters class to get more than one pot reading, however, is there an easier way in the seed code?

freq1.Init(hardware.knob[hardware.KNOB_1], 0, 127, Parameter::LINEAR);
freq2.Init(hardware.knob[hardware.KNOB_2], 0, 127, Parameter::LINEAR);

Thanks in advance and apologise if this is really obvious. Had a busy day!

D

Hey,

This is how I did it, although there might be a better way. And I didn’t think this was really obvious!

in the main loop (to setup):

AdcChannelConfig adc[4]; //array size for number of ADC channels you need

adc[0].InitSingle(hw.GetPin(15));
adc[1].InitSingle(hw.GetPin(16));
adc[2].InitSingle(hw.GetPin(17));
adc[3].InitSingle(hw.GetPin(18));

hw.adc.Init(adc, 4); //my DaisySeed instance is called hw
hw.adc.Start();

and then to get the values:

hw.adc.GetFloat(0);
hw.adc.GetFloat(1);

etc

I wrote my own function to scale the outputs with a different curve (Exp, Log etc).

5 Likes

thanks for this!

This weeks been super busy and only just had a chance to try! Works a treat, thank you!

D