Makeblock-official / PythonForMegaPi

python for MegaPi with Raspberry Pi
http://openlab.makeblock.com
49 stars 26 forks source link

Python2 Python3 switch may have wrong print statement. #19

Open clplaneguy opened 5 years ago

clplaneguy commented 5 years ago

I am working with the Makeblock Ultimate 2.0 to get it to work with a Raspberry Pi 3 B+ though Python-for-MegaPi! I have been studying and learning the software. Now, all of a sudden, it seems that the software has changed. I am working with an encoder motor and running the sample program encoderMotorRun.py! Yesterday, all was as expected, I was learning. Today, the encoder motor takes thirteen steps to power up and six steps to power down. I have found that Python-for-MegaPi now supports Python3.

This behavior is not coming from the sample program. I have examined “megapi.py”. This behavior is not coming from there. It only chooses “megapi_python2.py” or “megapi_python3.py”. I should still be using Python2. I have examined “megapi_python2.py”. I see no code that should produce this behavior. I have examined “megapi_python3.py! Again, no code for this behavior. MrHezhisheng updated the code four days ago. However, I am not finding a reason for his change to cause my change. Although, his new “megapi.py” is now Python2/Python3 aware. His command to print in Python3 is a syntax I am not familiar with. His command to print in Python2 may be a Python3 command. It may be possible that Python2 cannot execute this Python3 command. At least it does not here. As for the thirteen-step process, I am still looking . . .

I found the reason for the thirteen-step process. I do not completely understand it. But, it is a result of an interaction with my code running in parallel with the firmware.

I still question the print statement.

My computer is not running this code yet, there is noway for this code to complete if I do not execute it!

MrHezhisheng commented 5 years ago

pip install megapi --upgrade ,and try it again.