Skip to main content

Physical Start/Stop button.

Dan's picture
Posted in

Hi Church,

I was wondering if there is a easy way for me access the functions for start and stop.
I would like to try a hack were I can program the Arduino with slim before I go out on location. But still have the ability to start or stop the engine with a simple momentary switch when I am out on location. I see that the code is all serial based but I can't seem to find where the original start/stop command is and how I would make it a part of the main loop so I can use a toggle function to call it.

Could you point me in the right direction or even post some "sample code"? :D

Dan.

Hey Dan, Check out the code

Hey Dan,

Check out the code starting at line 109 in OM_Alt_Control.pde for a way to get an "instant" response (pin change interrupts) to your button press, otherwise you can just check its status in the main loop. The code on how to stop the program starts on line 1264 of the OM_Serial_Com_Client.pde, it's just a few variables being set -- it's also done at line 335 of the OM_KeyFraming.pde file (I do really need to wrap that up in a function =)

So, your code would look something like this:

if( digitalRead(TOGGLE_PIN) == HIGH ) {
  if( action_status & B11110111 ) {
       // running? turn it off...
     action_status &= B11110111;
     run_time     = 0;
     camera_fired = 0;
     alt_trigger  = false;
     
       // clear out motor moved data                    
     for( byte i = 0; i < 3; i++) {
       motor_steps_moved[i]  = 0;
       motor_ramp_data[i][1] = 0;
       camera_repeat_home[i] = 0;
     }
  }
  else {
       // start running
     last_time = millis();
       // start program
     action_status |= B00001000;
  }
}

!chris

Thanks Chris, I will try

Dan's picture

Thanks Chris,

I will try definitely this out.

Dan.

Another question, When I

Dan's picture

Another question,

When I program the Engine with Slim, do these new values stay in EEPROM even when the power is off? Before I attempt this start/stop thing I need to know what happens to the state of the engine when the power to the Arduino is off? Currently if I cut power to the the Arduino (when the engine is running) and then turn it back on, the engine does not continue, and I usually have to open a new cmd shell to connect the port successfully again.

So I am just wondering if implement this physical toggle, program the board with slim and then disconnect the power until I am out in the field and then power it with a 9vlt and press the start button will the Engine retain the interval and shot count settings That I previously set?

Dan.

Dan, Not presently, no - the

Dan,

Not presently, no - the OMTLE does not save values to memory. (I guess I missed that part!) It does require you to upload a new program to it after being powered on. It would take some work to get everything saved to memory. (Not impossible though, the new code from the MX2 could likely be ported easily.)

!chris

So is MX2 replacing Timelapse

Dan's picture

So is MX2 replacing Timelapse Engine? or is it based on it? I'm wondering if there are plans for more dev on the timelapse engine at your end or is MX2 "the future"? :)

MX2 is a companion to the

MX2 is a companion to the TLE, providing a lower-cost, DC-motor option. I'm going to merge in all the useful stuff from MX2 to the TLE, but we're definitely moving forward with the TLE, and the next step is to get it its own dedicated hardware! (Maybe shield, maybe complete arduino-compatible solution, still working out those details.) There's a bunch of stuff waiting to be merged into the TLE trunk, like continuous/async stepper control, modularization of some of the components, a basic stand-alone UI and, of course, eeprom writing.

!chris

Nice one Chris, I will keep

Dan's picture

Nice one Chris,

I will keep an eye out for the next release! I've written a timelapse calculator with gui that may be useful to some of the community. I am just learning how to make and installer for it and then I will post.

Cheers!

Dan, it's here *grin* I can't

Dan, it's here *grin*

I can't wait to see your calculator app!

!c

Bringing to the top, as per

Bringing to the top, as per the spamfix issue.

I look forward to seeing the

bdodds's picture

I look forward to seeing the calculator app too. :)