Hello everyone. First of all, I'm new at this and this is an amazing technology and supporting community! For the last month I've been reading stuff and working on my 1st project and the amount of info given here is great.

Now for my question (I've looked around but wasn't able to find answers):Using the Knob sketch I'm building a Follow Focus for my camera. what I'm trying to figure out is how be able to add a "Record" function to the code. What I mean is to have the ability to to push a button telling to Arduino to record my potentiometer data (as I move it, the servo of course moves and changes the focus on my camera), than "stop" the recording and play it back causing the servo to repeat (once) the movement and timing of my "focus pulling".

I would appreciate any advice, or if someone could point me to a relevant link.

Look at arrays. As a precursor, write a sketch with an array initialized with some potentiometer values. Iterate through them to make the servo move to different positions. Don't forget to allow some time between each or the servo will appear to immediately go to the last value.

Then you need to adapt that code to take potentiometer values and store them in the array when you set a switch to tell it to. Be careful - it will be easy to overflow the bounds of the Arduino's memory if you don't check your array bounds.

Does the playback have to be at the same speed that you did it? If so, it's going to be a little more complicated.

void loop() { // val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) - left in so you can see what replaced it for(int i=0;i<10;i++) { val = map(potvalues[i], 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) myservo.write(val); // sets the servo position according to the scaled value delay(200); // wait for the servo to get there }delay(3000); // wait before starting the sequence again }

Compiled, not tested. It illustrates the principle, but it isn't very good code. The use of all those manifest constants, particularly 10, is a sin. The use of delay too, is handy here, but not recommended generally.

My project is slowly progressing (actually I should say I'M slowly progressing...) and my 3 questions are: 1. Is it possible to store the pot data into an array while at the same time send it over to the servo? This way I can both see what I'm doing and "record" the info for later retrieval.2. In this project I'm expanding on the Knob sketch, adding the array in order to record. I want to be able to begin , stop and playback this recording using buttons. This means putting some "If" structures into the main loop of the sketch. Will this make my reading from the pot and writing to the servo slower (because the code will check to see if the button is pressed)? Should I use another structure? Is Interrupt better suited for this?3. By other structure I mean maybe 2 loops that can be switched between by a button. Is that even possible?

Can you modify your post to use [code] tags, instead of [quote]. It looks like you aren't using array indexing to store the servo position, but that could well be because the [i] is being converted to an italic tag.

I have a similar problem. I'm trying to get the data from 3-D animation software into the Sketch to move the servos. I have the output movement working, but the process of loading it is tedious. Maybe I should try pots? I want the movement to look natural like a human body moving.