camera slider help, or where to start code examples....

Hi I want to make a time lapse camera slider. What I would like is move-shot-move, move@ continuous speed(video slider), move to point(ie manual control), stop when limit switch has been triggered.

I’m a beginner but I’m going to have some time off work coming up soon, so I’m eager to learn.

what I have done so far…
mega and uno boards.
seeed studio tft screen
seeed studio motor control
relay board
npn transistors, resistors, wire, leds…
slider mechanics.

download and installed some code I do have a working version but it’s limited

What I want mostly is in these two builds of code but I lack the knowledge to combine the code and add what I need.
I have started to watch learning Arduino programming video’s and have written some basic code (turn on and off a led type of stuff)

So the big question
where do I start?
I would take someone rewriting the code, but I really want to know how to do it myself also…
thanks Bob

code attached

dollymove2.1.ino (10.1 KB)

CameraMotionControlSystem.ino (18.9 KB)

Previous postings.

Thank you zoomkat, I have already searched although helpful, no one seems to get help.

I’m thinking it’s going to be a figure it out yourself type of thing.

I know I can do it, just going to take time…lol

I’m waiting on a couple of items and I will see how the first code works, seems to work on the bench without the stepper motor and cable to fire my camera.

The hardest part I’m having is trying to wrap my head around the menu on the tft panel.
I think I got how to post the buttons on the screen, but when I push a button, I get lost with the “case” statements.

So I have a home screen with buttons on it that say time lapse, video slider, manual movement, and I guess cancel.

I push a button which I define by the p.z x and y coordinates, I don’t get how to call the function that is represented by that button.

Is there a place to learn about what I’m trying to do?
thanks again

Think this way, have one variable that keeps up with the state of what you want to do. When you pick something from the menu, all you have to do is update that variable. In your loop you can have a switch case that looks at that variable and calls the appropriate function to do the thing you want to do. It will keep calling that function over and over until you set the state variable to something else.

ok I wrote a sketch to draw button’s on screen and getting the point touched.
could someone show me an example of what I need to do to have a new screen for each button.
here’s what I wrote…

#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
#include <SeeedTouchScreen.h>

#define TEAL 0x0f10
#define ORANGE 0xf8e0
#define TOUCH_DELAY 100

int x=0;
int y=0;
int p=0;
TouchScreen ts = TouchScreen(XP, YP, XM, YM);

void setup() {



Tft.fillRectangle(1, 1, 238, 318, WHITE);

Tft.fillRectangle(5, 5, 230, 54, TEAL);
Tft.drawString(“TIME LAPSE”, 10, 22, 3, BLUE);

Tft.fillRectangle(5, 64, 230, 54, TEAL);
Tft.drawString(“VIDEO SLIDER”, 10, 81, 3, BLUE);

Tft.fillRectangle(5, 123, 230, 54, TEAL);
Tft.drawString(“MANUAL CTRL”, 10, 140, 3, BLUE);

Tft.fillRectangle(5, 182, 230, 54, RED);
Tft.drawString(“CANCEL”, 10, 199, 3, BLACK);


void detectKeyPress(){

Point p = ts.getPoint();
x = map(p.x, TS_MINX, TS_MAXX, 0, 240);
y = map(p.y, TS_MINY, TS_MAXY, 0, 320);

if (p.z > __PRESURE)

void loop() {


Ok I have been working on it more, I have the menu’s I need.
I think I have learned quite a bit just doing this.
now I need a little help
how do I get a button to go to the next menu?
So I push the time lapse button, I want the screen to change to the time lapse screen.
From what I have been able to figure out I need to get the p.z coordinates x and y then figure out if they fall inside of my box for which menu item.

So I’m guessing I need to name each of my menu’s

is this how I do it?

tft.fillRectangle(1,1,120,120, BLACK);}

Do I need to watch and study video’s on functions?

drawing_buttons_on_screen.ino (4.89 KB)

Well I got the functions figured out!!!

took me the longest time to figure out they had to go between void startup and void loop...
but they look like

void AdjustMenu(){
//Adjustment menu

Tft.fillRectangle(1, 1, 238, 318, WHITE);//fills screen with color
Tft.fillRectangle(5, 5, 230, 54, TEAL);//fills top rectangle
Tft.drawRectangle(5,5,230,54,BLACK);//draws black outline around rectangle
Tft.drawString("THING TO BE ADJUSTED", 70, 27, 1, BLUE);//menu item to be adjusted
Tft.fillRectangle(5, 64, 230, 54, TEAL);
Tft.drawString("+", 119, 86, 2, BLUE);//increase value of item
Tft.fillRectangle(5, 123, 230, 54, TEAL);
Tft.drawString("-", 119, 142, 2, BLUE);//decrease value of item
Tft.fillRectangle(5, 262, 230, 54, RED);
Tft.drawString("NEW VALUE", 40,210,3,BLACK);//new value of item

Next I have to figure out which button gets pressed and do something with the result....

Might be some time before I get to get back to this....

Going to doctor today (whole reason I'm going to have free time)

Free free to help!!!! LOL

thanks Bob

If I was working on this project I would begin by getting the low-level functions working first then work my way up, writing the menu code at the end.

For example, I might start with a move() function, then add a shoot() function. Once these were working there could be a timeLapse() function that would call the two lower level functions. During development I would just call timeLapse() in the code, not using the screen, probably giving it different arguments to go faster or slower.

When the basic functionality was working I would create functions for each menu and act based on the button number. Something like:

void timeLapseMenu(int choice)

  case 1:  // GO button

  case 2:  // adjust +

  case 3: // adjust -




At this point everything can still be tested in code by calling timeLapse(1); to simulate button #1, etc.

Once all this was working I would hook up the menus. You’ve already figured out how to write a function to display a menu. If detectKeyPress() could detect which key # was pressed it would then just be a matter of calling the correct function based on the current menu, passing it the button number.

You can do this project any way you want, but that’s how I’d do it. Good luck, post your progress.