Replacement for a couple replacing Arduino functions with Daisy Lib ?- millis and ROTARY SWITCH from a pot-- bitshift

I am trying to port over some code I once wrote for Arduino and there a few conventions I was so used to that I am feeling a bit stuck on how to re-write those in straight C++ and I am wondering if there are helper functions to achieve the same goal.

For now the one I most would like to replace is Millis.

I used to use Millis all the time. for example in a sequencer when i want to know at what step I turned a knob

long digTime[2] = {0, 0}; // the times of the last HIGH
then in the main loop

digTime[0] = millis();

or in another case

// if we’ve been paused long enough, read the value
if (millis() - XlastPosMillis > pauseTime && millis() - YlastPosMillis > pauseTime && analogRead(2) != lastCV) {}

so I guess my question is this…IS there some helper function that counts milliseconds in the Daisy Lib?
and if so how do i call it :slight_smile:

The other thing I was looking into was how to bitshift the value coming out of the knobs on the daisy POD to create a rotary switch. In the past I would have simply bitshifted the analog read value and used that value as my “switch pos”

int tempPos = analogRead(1) >> 7;

however on the POD the knob.1 is a float value which cant be immediately bit shifted. but looking around it looks like DSY_CLAMP might do a similar thing?

this would be super helpful on the POD where you only have two knobs and two buttons but by chopping up the knobs into say 4-8 sections you could allow for more “switches”.


Hi, in libDaisy the system clock has a millisecond counter.

You can use System::GetNow() to get the time in milliseconds since the module booted (unsigned 32-bit value).

Most of the board support classes have shorthand wrappers for this (i.e. DaisySeed::GetNow()), etc.

The System module also has higher resolution timers for microseconds, etc. but they wraparound much faster, so are mostly useful for short measurements.

Hope that helps!

thanks a lot- Will try that right away