# Real-time Graph on the computer

Recently, I’m learning mico-bit in school. So it struck me that I may be able to use the serial library in Python to read data transformed from the Brain. To achieve that goal, I use printf() function to send the data, and use some of the functions in the serial library in Python to read that data.
After that, I tried to use the matplotlib library in Python to turn the data into a graph. So that I can have a real-time graph on the computer screen, without a SD card or Excel. And I only need to connect the computer and brain with a usb cable.
Here are some of my pics.

5 Likes

That’s very interesting data… What are the units on the motor temperature graph’s axes? It hovers at multiples of 5 so smoothly.

1 Like

The x axis is seconds, and y axis is pct.(a unit offered by the vexcode api)
And the minimum unit of pct is 10 percent, But because it is the temperature of the drivetrain, The minimum unit of pct will be 5 percent(Calculate the mean of two motorgroups each side)So,it will hover at multiples of 5 smoothly.
This unit is pretty interesting. In my opinion, it is used to describe how close the motor is going to be shut down because of the heat. As you can see, the pct goes higher,the temperature is higher. If the temperature of the motor is higher than 60 percent(pct), the motor’s power is going to be limited. And I found that if the temperature is higher than 70%, the motors on the drivetrain will not be able to drive the bot.
The reason why I draw this graph is to see how long it will take if I want to cool the motors from the overheat situation, and the rate of decreasing.