Go Down

Topic: Saving and re-using values from potmeter (Read 214 times) previous topic - next topic

mrlrs

Hi,

I'm struggling with code for my project.

Two potentiometers read values and I want to store 10 of these consecutive values, from each potentiometer, so that I can use these values to
write to two digital pins later. This need to repeat for an amount of time and then it chooses 10 new values and writes them to the pins again etc.


Code: [Select]


val1 = analogRead(POT1);
val2 = analogRead(POT2);

// storing part

analogWrite(output, );
analogWrite(output, );

delay(3000);



Thanks in advance,

Regards,
mrlrs

majenko

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

mrlrs

Thank you for your quick reply.

I have looked into arrays but that causes a lot of new random values from the potmeter.

Is it possible to code it that it makes an array of a random sequence from 10 potmeter values?
Then extract the values from the array and write these to the outputs?

majenko

I don't know quite what it is you're asking.

What is it that you want to achieve?
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Go Up