CV_INPUT = 0 TENS_OUTPUT = 0 ONES_OUTPUT = 1 TENTHS_OUTPUT = 2 HUNDRETHS_OUTPUT = 3 THOUSANDTHS_OUTPUT = 4 TENTHOUSANDTHS_OUTPUT = 5 setDisplayMode("log") log("Input " .. CV_INPUT .. ": CV") log("Output " .. TENS_OUTPUT .. ": 10's") log("Output " .. ONES_OUTPUT .. ": 1's") log("Output " .. TENTHS_OUTPUT .. ": 0.1's") log("Output " .. HUNDRETHS_OUTPUT .. ": 0.01's") log("Output " .. THOUSANDTHS_OUTPUT .. ": 0.001's") log("Output " .. TENTHOUSANDTHS_OUTPUT .. ": 0.0001's") counter = 0 function process(sampleRate, sampleTime) local periodNSamples = 1 / sampleTime counter = counter + 1 if (counter > periodNSamples ) then counter = 0 local value = getVoltage(CV_INPUT) local tens = math.floor(value / 10) local remainder = value - ( tens * 10 ) local ones = math.floor(remainder) local remainder = remainder - ones local tenths = math.floor(remainder * 10) local remainder = remainder - ( tenths * 0.1 ) local hundreths = math.floor(remainder*100) local remainder = remainder - ( hundreths * 0.01 ) local thousandths = math.floor(remainder*1000) local remainder = remainder - ( thousandths * 0.001 ) local tenthousandths = math.floor(remainder * 10000) -- add 1 for Computerscare anim-gif 0="0" .... 10="9" setVoltage(TENS_OUTPUT, tens + 1 ) setVoltage(ONES_OUTPUT, ones + 1 ) setVoltage(TENTHS_OUTPUT, tenths + 1 ) setVoltage(HUNDRETHS_OUTPUT, hundreths + 1 ) setVoltage(THOUSANDTHS_OUTPUT, thousandths + 1 ) setVoltage(TENTHOUSANDTHS_OUTPUT, tenthousandths + 1 ) end end