How to Solve NameError: name 'Pin' is not defined -- machine

Solution: Import the 'Pin' module

To Solve the error, add the following line to the top of your code.

from machine import Pin

 

For more information:
Python machine Pin