Reputation: 11
I am having some trouble with a code that I've written in MicroPython, for a Raspberry Pi Pico. I don't have any hardware killswitch installed, so I want to do that from a software implementation since I can't press the STOP button from Thonny, as the loop is running way too fast. The only way I can stop the program is by disconnecting the Raspberry from my computer, then disconnecting the gyroscope then plugging it again. And since I have to tune some parameters, this action takes a lot of time. Do you think you could help me with a simple killswitch that can kill my program by pressing a key on my keyboard or something?
I tried to spam stop button but it still wouldn't work. This is the loop I'm fighting:
def main():
#time.sleep(5)
H_bridge.init_motor_data()
mpu6050.configure_mpu()
#adxl345.configure_adxl()
get_offsets()
general_timer.init_general_timer(pid_control)
while True:
pass
if __name__ == "__main__":
main()
Upvotes: 0
Views: 59