I was coding a code for my Arduino UNO, and I followed a tutorial because this was the first time I had used python on a Arduino UNO. The guy in the tutorial used pip.main
. I was just trying to get to a start on the code. I am using Python 3.7.5 and pip version 19.2.3. I have already tried looking around in Stack Overflow and other similar websites, but everything the community suggested didn't work. I also have very limited time to fix this problem. Here is my code:
try:
from pyfirmata import Arduino, util
except:
#the problem is here
from pip._internal import main
main(['install', 'pyfirmara'])
from pyfirmata import Arduino, util
board = Arduino('')
iterator = util.Iterator(board)
iterator.start()
#code here
board.exit()
Help would be greatly appreciated!!