Is it possible that CTRL+C could result in the cleanup function not running correctly? My thinking is this: When you press CTRL+C the program starts the cleanup when the CTRL key is pressed, but when you click 'C' it will terminate the program regardless of your cleanup state. This means that the cleanup function needs to finish running in between CTRL being pressed and C, which could result in the cleanup function being cut short. This can be mitigated if you press just 'C' or just 'CTRL', or any other non breaking code keyboard combinations. I've never coded in python before so could be wrong about the catch block trigger being any keyboard key though.
Hey Kevin, almost correct :) Actually pressing CTRL+C is just one action, and it will try to terminate the running program. As the program is "stuck" inside a loop, it will end from there, and the GPIO.cleanup() line won't be called. Solution to that --> check at 8:30 in the video
Is it possible that CTRL+C could result in the cleanup function not running correctly?
My thinking is this:
When you press CTRL+C the program starts the cleanup when the CTRL key is pressed, but when you click 'C' it will terminate the program regardless of your cleanup state. This means that the cleanup function needs to finish running in between CTRL being pressed and C, which could result in the cleanup function being cut short. This can be mitigated if you press just 'C' or just 'CTRL', or any other non breaking code keyboard combinations.
I've never coded in python before so could be wrong about the catch block trigger being any keyboard key though.
Hey Kevin, almost correct :)
Actually pressing CTRL+C is just one action, and it will try to terminate the running program. As the program is "stuck" inside a loop, it will end from there, and the GPIO.cleanup() line won't be called.
Solution to that --> check at 8:30 in the video
GETTING THIS ERROR WHEN i TRY TO RUN @No module named 'RPI'
where you import is RPi not RPI