How to print from Python


#1

I would like to explore the use of the makeblock python libraries for Codey. Many of the examples use “print” statements and if I attempt to use Putty on the Windows PC computer to the coms port it is already occupied. How can I see the output of the print statement. The Makeblock IDE does not support a serial terminal or monitor.


#2

Hi dsrc34,

I’m programming in Python with Codey and I haven’t encountered any limits yet. The Terminal or monitor is located at number 1 and you can delete it with number 2.

The Print () instruction in Python is a programmer’s best friend who wants to debug. By adding print () in your Python program, the display will be redirected to your screen (IDE mBlock). Me, it works in upload mode and plug in with a USB cable.

I hope that the answer, meets your need?

Here is an example :


#3

Hello Crackel
thanks for the reply. What you said is what I expected but it is not happening. I was able to display print statements by disconnecting mblock from Codey and then opening up a separate serial monitor on my Windows PC such as Putty and could see the results there. I do not understand why mBlock does not allow me to see codey’s print results directly. I replicated this problem on two separate Window PCs wit the same result and updated codey’s firmware.


#4

Hi dsrc34,

sorry for the misunderstanding i am really null in english.

So, I get the result you expect from the mBlock program. Consequently it is possible and it is even the minimum to work in Python.

I think I have found the source of the problem. He’s in the mLink. The PC version of mBlock is functional but the version which requires mLink does not work. The same code but the behavior is different.

Personally, Makeblock seems to favor the Web version with mLink, they must look at this problem because of python programming without the print () instruction to inspect the content of our variables, it is too difficult.

I hope Makeblock will answer you on this problem.


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.