Author Topic: Button latch and toggle  (Read 12994 times)

Offline Mike AA

  • PLUS+1 Guru
  • *****
  • Posts: 116
  • Karma: +0/-0
    • Dewind Dewatering
Button latch and toggle
« on: August 11, 2016, 03:26:10 PM »
having a bit of difficulty figuring out a latch and toggle setup. I figured out how to do a simple latch toggle with a data flip-flop that turns on with one press turns off with another press, works well. I have a setup where I am trying to set my travel speed with a trigger pulled for 3 seconds then use the same trigger to then click once to engage the drives. The problem I am having is with my initial code the drive would enable or disable depending on its previous state when holding the trigger. I added another toggle setup to latch at the end of the 3 seconds which then enables the enable/disable toggle. but then I go to reset the speed this toggles the 3 second latch and shuts it off until I do a reset speed hold again.

Attached is my attempt so far.

Anyone have ideas to do all this with only one button?

Thanks
« Last Edit: August 11, 2016, 03:27:41 PM by mikeaa12 »

Offline Jakob

  • PLUS+1 Expert
  • ****
  • Posts: 98
  • Karma: +2/-0
Re: Button latch and toggle
« Reply #1 on: August 12, 2016, 10:41:03 AM »
Something like this might do the trick.

/Jakob

Offline Mike AA

  • PLUS+1 Guru
  • *****
  • Posts: 116
  • Karma: +0/-0
    • Dewind Dewatering
Re: Button latch and toggle
« Reply #2 on: August 12, 2016, 04:24:40 PM »
Jakob,

This should work. I think I started to do this exact setup but missed the NOT so it didn't work and frustrated me. I will get this loaded this morning yet and see what it does.

Thanks!

Offline Mike AA

  • PLUS+1 Guru
  • *****
  • Posts: 116
  • Karma: +0/-0
    • Dewind Dewatering
Re: Button latch and toggle
« Reply #3 on: August 15, 2016, 07:52:34 PM »
Jakob,

Unfortunately this code is doing what I had trouble with before. You can hold and set and release and it will turn on at set speed, thats good. If you need to adjust speed, so hold and release it will then shut down. I am starting to think using one button for this function isn't going to work.

Anyone else have any ideas to make this functionality work?

Offline Nilla

  • PLUS+1 Guru
  • *****
  • Posts: 253
  • Karma: +14/-0
Re: Button latch and toggle
« Reply #4 on: August 16, 2016, 02:28:47 PM »
Hi Mikeaa12!

It sound like you're trying to create a cruise control? Hold button for 3s to activate it, set speed with one press. I hope the attached picture could be something for you then!

Best regards
Nilla
PLUS+1 Helpdesk
« Last Edit: August 16, 2016, 03:03:10 PM by Nilla »

Offline Mike AA

  • PLUS+1 Guru
  • *****
  • Posts: 116
  • Karma: +0/-0
    • Dewind Dewatering
Re: Button latch and toggle
« Reply #5 on: August 17, 2016, 01:30:46 PM »
Nilla,

Yes you are correct! I am putting cruise control on a 500,000+ Pound Trencher. We ended up just using the trigger to set the speed without needing to hold until set then a toggle on another button to enable/disable. A couple guys didn't want to have the waiting period. I will try out you code in another program which I still may need the functionality.

Thanks!
Mike