Pages: [1]   Go Down
Author Topic: Saving and re-using values from potmeter  (Read 155 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: 92
Posts: 3969
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

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

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: 92
Posts: 3969
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

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Pages: [1]   Go Up
Jump to: