I'm working on a tkinter user interface to produce a logical output for controlling a motor. The motor has an onboard control system (Clearpath MCPV model being used in incremental positioning mode) so I just need to send it a 5V pulse at least 20ms in duration and that triggers it to move a pre-set distance.
I have the "manual mode" working fine; you press the input button, it sets the GPIO high, delays for 25ms, then sets it low again. I realize that using a delay is not good practice, but the time interval is so short that I don't think it will matter if the user can't press anything for 25ms. I've run and tested this with the system I'm driving and it works great.
The issue I'm having is how to set up an automatic mode. When in automatic mode, I want the user to be able to start and stop a regular, timed signal to the motor by toggling the input button (which changes appearance to enter a running state, then changes back to the "idle state" within automode when you press it again). The only ways I have considered doing this are to either
1) Generate appropriate PWM or
2) to somehow use the .after() method with a function (and again within that function) to create repeated toggling of the switch i.e. an automated, repeating version of the manual logic.
From what I've read, you cannot generate PWM with frequencies less than 10Hz on an RPi (I need a range of 1/3-2/3Hz, I'm trying to produce 1200-2400 units per hour). I have not been able to get the .after() method to work consistently; if I start the automode right after running the script, it works fine. However, once you try to pause the signal, you can't start it back up again. Also, if I don't start the signal quickly enough after running the script, it won't ever produce the signal even though my UI looks like it should be working. What am I missing here? Does anyone have good documentation of .after()? I found a bunch of tutorials and yt videos but there isn't any formal documentation from what I can see.
submitted by /u/wokka7
[link] [comments]
More...
Issues generating ultra-low frequency PWM-like signal
The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.
Post Reply
1 post
• Page 1 of 1
- /RaspberryPi
- Corporate
- Posts: 2449
- Joined: Wed Jun 05, 2019 1:29 am
Post Reply
1 post
• Page 1 of 1
Return to “Raspberry Pi Forum”
Jump to
- From Retro to Current
- ↳ Classified Ads
- ↳ Community
- ↳ Marketplace
- ↳ Jobs
- ↳ Dating
- ↳ Housing
- Nintendo Forums
- ↳ SNES Classic Edition Forum
- ↳ Switch Forum
- ↳ NES Classic Edition Forum
- ↳ Wii U Forum
- ↳ 3DS Forum
- ↳ Wii Forum
- ↳ DS Forum
- ↳ Gamecube Forum
- ↳ Game Boy Advance Forum
- ↳ Game Boy Color Forum
- ↳ Nintendo 64 Forum
- ↳ Super Nintendo Forum
- ↳ Game Boy Forum
- ↳ Nintendo Entertainment System Forum
- ↳ Game & Watch Forum
- SONY Forums
- ↳ PlayStation 5 Forum
- ↳ PlayStation Classic Forum
- ↳ PlayStation 4 Forum
- ↳ PlayStation Vita Forum
- ↳ PlayStation 3 Forum
- ↳ PlayStation Portable Forum
- ↳ PlayStation 2 Forum
- ↳ PlayStation 1 Forum
- Microsoft Forums
- ↳ Xbox Series Forum
- ↳ Xbox One Forum
- ↳ Xbox 360 Forum
- ↳ Xbox Forum
- SEGA Forums
- ↳ Genesis Mini Forum
- ↳ Dreamcast Forums
- ↳ Sega Saturn Forum
- ↳ Genesis Forum
- ↳ Master System Forum
- Other System Forums
- ↳ General Discussion
- ↳ Other Console Forum
- ↳ Arcade Cabinet Forum
- ↳ Windows, Mac, & Linux Forum
- ↳ Atomiswave Forums
- ↳ WWW.ATOMISWAVE.NET
- ↳ General Discussion
- ↳ Tech Support
- ↳ System Setups
- ↳ Modified Moderboards
- ↳ Home Consoles & Systems
- ↳ Arcade & Candy Cabinets
- ↳ Marketplace
- ↳ Video Game Marketplace
- ↳ Game Discussion
- ↳ Video Game Catalogs
- ↳ FAQs, Reviews, & Guides
- ↳ Assorted Discussion
- ↳ Custom Ideas
- ↳ Open Discussion
- ↳ SNK Neo Geo Forums
- ↳ General Discussion
- ↳ Buying & Selling
- ↳ Tech Support
- ↳ Systems
- ↳ Neo Geo Arcade Stick Pro Forum
- ↳ Neo Geo Mini Forum
- ↳ Neo Geo X Forum
- ↳ Neo Geo CD Forum
- ↳ Neo Geo MVS Forum
- ↳ TurboGrafx-16 Forums
- ↳ General Discussion
- ↳ Marketplace
- ↳ Magazine Scans
- ↳ Games
- ↳ TurboChip/HuCard Forum
- ↳ CD-ROM²/Super CD-ROM²/Arcade CD-ROM² Forum
- ↳ Systems
- ↳ TurboGrafx-16 Mini Forum
- ↳ TurboDuo Forum
- ↳ TurboExpress/PC Engine GT/LT Forum
- ↳ SuperGrafx Forum
- ↳ TurboGrafx-CD/PC Engine CD Forum
- ↳ TurboGrafx-16/PC Engine Core Forum
- ↳ Raspberry Pi Forum
- ↳ Atari Forum