MicroPython runs on top of ev3dev, which is a specific version of Linux. Linux is an operating system. (Other popular operating systems are Microsoft Windows and Apple macOS.) This means that your EV3 is almost like a real computer, just much smaller.
Note
If you just want to write MicroPython programs, you can skip the remaining sections.
The remaining sections are aimed at curious users who want go beyond MicroPython and access some of the other built-in features of Linux and ev3dev.
Although your EV3 Brick is quite like a real computer, you do not interact with it using a big screen and a mouse. Instead, you can access files and programs on it using the command line. It is also called the terminal.
Follow the steps in Figure 16 to access the command line. Now you can enter commands by typing them in and pressing enter.
Figure 16 Opening the Linux command line and running the ls command.
Running basic commands
For example, if you type the following command and press enter:
ls
then you will see the contents of the current folder. Figure 16 shows the result: it listed the project folder of the getting_started project that we just ran.
If you type the following command and press enter:
exit
then the command line will be closed. Alternatively, click the garbage icon shown in Figure 16.
You can copy text from the command line by selecting it and then pressing ctrl shift c. You can paste text into the command line using ctrl shift v.
Running commands as an administrator
Some commands require a password to run. This is similar to administrative tasks on your computer or tablet, such as installing a new app. These commands work like any other command, but you add sudo in front of them.
As an exercise, you can run the following command to turn the EV3 Brick off:
sudo poweroff
You will be prompted for a password. Type maker and then press Enter.
Warning
Only run commands with sudo if you know what you are doing.
Learning more about the command line
To learn more about the command line and many of the available commands, we recommend reading the beginner-friendly free ebook called The Linux Command Line.
To learn more about ev3dev-specific tips and tricks, visit the ev3dev website.
When you search for your EV3 using Visual Studio Code, you see all EV3 Bricks listed by their name. By default, all EV3 Bricks are named ev3dev. Follow these steps to change that name:
Open Visual Studio Code and connect to your EV3 as usual.
Read the steps above about running commands as an administrator.
Think of a good name. In this example, we’ll call it autonomous-vehicle2
Enter the following command and press enter:
sudo hostnamectl set-hostname autonomous-vehicle2Reboot the EV3 Brick for the change to take effect.
You may need to reboot your computer as well.
EV3 Brick names should only contain lowercase letters a through z, the digits 0 through 9, and the hyphen -. It must start with a letter or digit. It cannot include spaces or other symbols.
本文介绍如何在Scratch中对EV3机器人进行开发。
在这一章中,你将学习一组传感器,它们被用来执行有根据的动作。
在本章中,您将学习启发式搜索策略背后的基本思想以及如何实现爬山算法,这是 leJOS EV3 中最典型的启发式方法之一。
这一章向你介绍了在莱霍斯 EV3 使用的笛卡尔坐标系的基础知识。它还教你如何在导航课程中应用编程方法来控制轮式车辆,以便在二维平面中用坐标描绘出预定义的路径。
本章提供了如何使用乐高 MindStorm EV3 公司建立 Java 机器人编程环境的分步指南,包括乐高 MindStorm EV3 的基本概述和leJOS-EV3的介绍。