Hello, first post. I am making a small little bot to fill idle time. I have everything up and running EXCEPT whenever i use the keyboard interrupt or end the script any other way the atexit.register(turnoffMotor) with the required function to release all the motors, nothing stops. the motors keep on going. nothing stops till i completely reset the pi.
any suggestions?
Dc Motor Hat
Moderators: adafruit_support_bill, adafruit
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Dc Motor Hat
You'll need to create a signal handler.
Signals are messages the kernel sends to a program while it's running. They're kind of like interrupts in the microcontroller world, but they're generated by software instead of a rising or falling edge on an IO pin. Signal handlers are functions that run when when the program receives a given signal.
Python has its own set of rules and conventions for handling shutdown signals. Here are links to the library reference and an example of how to write the code:
https://docs.python.org/2/library/signal.html
https://www.g-loaded.eu/2016/11/24/how- ... g-signals/
Signals are messages the kernel sends to a program while it's running. They're kind of like interrupts in the microcontroller world, but they're generated by software instead of a rising or falling edge on an IO pin. Signal handlers are functions that run when when the program receives a given signal.
Python has its own set of rules and conventions for handling shutdown signals. Here are links to the library reference and an example of how to write the code:
https://docs.python.org/2/library/signal.html
https://www.g-loaded.eu/2016/11/24/how- ... g-signals/
- Halover9k
- Posts: 2
- Joined: Fri Feb 16, 2018 10:21 pm
Re: Dc Motor Hat
Many thanks the the quick reply! i had no clue, your awesome!
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/