Take a screenshot of the LCD with Python-LEGO Mindstorms

When writing articles using LEGO Mindstorms EV3 (hereafter EV3), images may be inserted. You may want to use the EV3 screen display to explain the situation, such as when connecting the EV3 via Bluetooth. This time, I will describe how to take a screenshot of the LCD screen of such EV3.

About EV3

Educational version LEGO® MINDSTORMS EV3

Environment in this article

Wireless connection ~ Shooting

First, connect the EV3 and PC via Bluetooth. Click here for the connection method (https://qiita.com/Hiroki-Fujimoto/items/6ce278411ca151fee750#pc%E3%81%A8ev3%E3%81%AEbluetooth%E6%8E%A5%E7%B6%9A) reference.

Then access EV3 from VS Code's ev3dev extension. 1.png When access is complete, a green circle will be displayed. Left-click on the 3 EVs you are accessing to display the menu, so select Take Screenshot. 2.png

Then, the shooting result window will be displayed on VS Code. The path to the folder containing the PNG images is displayed at the top of the window. 3.png

The actual PNG file is output as follows. Unlike the black and white screen of LCD, the selected part is displayed in blue. 3-1.png

Wired connection ~ Shooting

When you want to take a picture of the LCD screen before wireless connection, such as when explaining the procedure when connecting via Bluetooth By connecting EV3 and PC with a USB cable, you can access from VS Code in the same way.

First, connect the EV3 and PC using a USB cable. No special settings are required when connecting via Bluetooth. 10.png After that, access EV3 from ev3dev of VS Code. The notation that was Bluetooth network connection at the time of Bluetooth is changed to Ethernet 7 at the time of USB connection. 4.png

You can take a screenshot of the LCD screen when connected via USB by left-clicking on the 3 EVs who are accessing in the same way and selecting Take Screenshot from the menu. 5.png

The actual PNG file is output as follows. 5-2.png

LCD screen shooting during program execution

If the above two steps are performed when the program is executed, the characters displayed on the LCD can also be photographed.

This time, create the following program on VS Code and shoot the LCD screen when it is executed on EV3. Click here for how to create and transfer programs (https://qiita.com/Hiroki-Fujimoto/items/6ce278411ca151fee750#%E3%83%97%E3%83%AD%E3%82%B0%E3%83] See% A9% E3% 83% A0% E3% 81% AE% E4% BD% 9C% E6% 88% 90).

from ev3dev2.display import Display
import ev3dev2.fonts as fonts
import time

screen = Display()
screen.clear()
font = fonts.load('luBS12')

def main():
    screen.draw.text((10, 10), 'Test1 Display String!', font=font)
    screen.draw.text((10, 30), 'Test2!', font=font)
    screen.update()
    time.sleep(5.0)
    screen.clear()

if __name__ == "__main__":
    main()

After creating the program, click the mark below on VS Code to transfer the Workspace to EV3. 5-1.png

After the transfer, open an SSH terminal and run cd ev3 workspace / (cd workspace name /) Execute python3 display.py. 6.png 7.png

When the program is executed, a character string will be displayed on the LCD screen for 5 seconds, so select Take Screenshot during that time. 8.png

The program takes a screenshot of the character string displayed on the LCD screen. 9.png

The actual PNG file is output as follows. The background when the program is executed is displayed in yellow. 9-1.png

Recommended Posts

Take a screenshot of the LCD with Python-LEGO Mindstorms
[Python] Take a screenshot
Take a peek at the processing of LightGBM Tuner
Take the value of SwitchBot thermo-hygrometer with Raspberry Pi
Visualize the characteristic vocabulary of a document with D3.js
Calculate the product of matrices with a character expression?
[Python3] Take a screenshot of a web page on the server and crop it further
I want to take a screenshot of the site on Docker using any font
Take a screenshot in Python
A network diagram was created with the data of COVID-19.
Measure the importance of features with a random forest tool
Analyze the topic model of becoming a novelist with GensimPy3
The story of making a question box bot with discord.py
How to take a screenshot of the Chrome screen (prevent it from cutting off in the middle)
Process the contents of the file in order with a shell script
A story stuck with the installation of the machine learning library JAX
Save the result of the life game as a gif with python
Let's take a look at the feature map of YOLO v3
Find the optimal value of a function with a genetic algorithm (Part 2)
[Statistics] Grasp the image of the central limit theorem with a graph
[python, ruby] fetch the contents of a web page with selenium-webdriver
Take the execution log of Celery
[Introduction to StyleGAN] I played with "The Life of a Man" ♬
If you give a list with the default argument of the function ...
The story of making a standard driver for db with python.
Count the maximum concatenated part of a random graph with NetworkX
Get the URL of a JIRA ticket created with the jira-python library
The idea of feeding the config file with a python file instead of yaml
Get motor angles with Python-LEGO Mindstorms
The story of writing a program
The story of making a module that skips mail with python
Create a compatibility judgment program with the random module of python.
Let's take a look at the forest fire on the west coast of the United States with satellite images.
A story that visualizes the present of Qiita with Qiita API + Elasticsearch + Kibana
The story of a Parking Sensor in 10 minutes with GrovePi + Starter Kit
[EC2] How to take a screen capture of your smartphone with selenium
[AtCoder explanation] Control the A, B, C problems of ABC182 with Python!
Calculate the shortest route of a graph with Dijkstra's algorithm and Python
Get the number of searches with a regular expression. SeleniumBasic VBA Python
The story of having a hard time introducing OpenCV with M1 MAC
[AtCoder explanation] Control the A, B, C problems of ABC186 with Python!
Generate a list packed with the number of days in the current month.
[Introduction to Python] How to sort the contents of a list efficiently with list sort
[AtCoder explanation] Control the A, B, C problems of ABC185 with Python!
Calculate the probability of being a squid coin with Bayes' theorem [python]
Hit a method of a class instance with the Python Bottle Web API
Receive a list of the results of parallel processing in Python with starmap
The story of making a sound camera with Touch Designer and ReSpeaker
I made a GAN with Keras, so I made a video of the learning process.
Make a DNN-CRF with Chainer and recognize the chord progression of music
[AtCoder explanation] Control the A, B, C problems of ABC187 with Python!
Get the average salary of a job with specified conditions from indeed.com
I made a mistake in fetching the hierarchy with MultiIndex of pandas
[AtCoder explanation] Control the A, B, C problems of ABC184 with Python!
Align the size of the colorbar with matplotlib
Check the existence of the file with python
Measure the relevance strength of a crosstab
Search the maze with the python A * algorithm
A quick overview of the Linux kernel
Take the logarithm of the nonzero element of scipy.sparse
[python] [meta] Is the type of python a type?