Pages: [1]   Go Down
Author Topic: Saving and re-using values from potmeter  (Read 177 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

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

// storing part

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

delay(3000);


Thanks in advance,

Regards,
mrlrs
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You should read up on arrays: http://arduino.cc/en/Reference/Array
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

What is it that you want to achieve?
Logged

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

Pages: [1]   Go Up
Jump to: