I discovered by trial and error that when pressing stop in Thonny, the KeyboardInterrupt exception is raised.
Now, I need to figure out how to execute code inside the except block for any exception and print that exception.
Related topic: viewtopic.php?t=11901
Search found 3 matches
- Tue Mar 29, 2022 5:49 am
- Forum: General Discussion and Questions
- Topic: What type of exception does MicroPython raise when the stop button is pressed in Thonny?
- Replies: 3
- Views: 2195
- Tue Mar 29, 2022 3:46 am
- Forum: General Discussion and Questions
- Topic: What type of exception does MicroPython raise when the stop button is pressed in Thonny?
- Replies: 3
- Views: 2195
What type of exception does MicroPython raise when the stop button is pressed in Thonny?
If I write a code that for example looks something like this: try: while True: time.sleep(1) pass except: #Code that will be executed if the stop button is pressed in Thonny with open('data.txt', 'w') as f: f.write("Exception raised") The code inside except is executed if Thonny's stop button is pre...
- Sun Mar 20, 2022 1:34 am
- Forum: Other Boards
- Topic: Which ESP8266EX microcontroller pins found on the ESP01 module are not used or not connected to anything?
- Replies: 1
- Views: 1774
Which ESP8266EX microcontroller pins found on the ESP01 module are not used or not connected to anything?
As you may know, the ESP01 module has only 4 GPIO pins, and if you want to use the SPI communication protocol, you have to specify the sck, mosi and miso pins, otherwise, the following error will occur: `ValueError: must specify all of sck/mosi/miso` In my project, I don't need to use miso, so I nee...