Setting up VS Code EV3 Python programming
(English and French subtitles available.) UPDATE: EV3 Python version 2 was released after this video was made. It brings huge improvements – read about them on ev3python.com. Before watching this video you should watch the sister video at http://youtu.be/cqtRqsI6xMc about writing and running EV3dev Python scripts. Putting the EV3dev operating system on an SD card in your Lego EV3 robot makes it possible for the EV3 to run scripts written in Python, one of the world's most popular programming languages. See http://ev3python.com and http://ev3dev.org. This video shows how to set up your EV3 robot and your computer for EV3dev Python programming using the Microsoft Visual Studio Code editor with the EV3 extension. The 12 main steps are: 1. Obtain a suitable microSD memory card. 2. Download the latest Linux Debian Stretch ev3dev image. The 27 July 2018 Stretch image seems to be 'broken' so please avoid that particular image. 3. Download and install Etcher, a free utility that will allow you to flash the ev3dev image to the microSD card. 4. Use Etcher to flash the image to the card. 5. Insert the card into the EV3, boot the EV3, do some minor configuring and establish a connection to the computer via USB, WiFi, Bluetooth or Ethernet. 6. Download and install Microsoft Visual Studio Code (VS Code). This is a free multiplatform code editor, compatible with Windows, Mac OS and Linux. 7. Write and run some non-EV3 Python scripts. 8. Download and unzip the starter project. 9. Open VS Code, open the starter project folder and install two extensions. 10. Configure VS Code. 11. Connect VS Code to your EV3. 12. Write and run your first EV3 Python script! Links used in this video: The sister video about writing and running EV3 scripts using VS Code (watch that first, before this one) is at https://youtu.be/cqtRqsI6xMc http://ev3python.com http://ev3dev.org Get the latest Stretch image from http://oss.jfrog.org/list/oss-snapshot-local/org/ev3dev/brickstrap Get Etcher from http://etcher.io For setting up a Bluetooth connection see http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-bluetooth Get Microsoft Visual Studio Code from http://code.visualstudio.com/Download VS Code is available in 14 languages. See https://code.visualstudio.com/docs/getstarted/locales#_changing-the-display-language Get the starter EV3 Python project from http://github.com/ev3dev/vscode-hello-python The polygon.py script: t = turtle.Pen() sides=int(input('How many sides?')) for n in range(sides): t.forward(100) t.left(360/sides) sleep(6) The demo.py script: #!/usr/bin/env python3 from ev3dev.ev3 import * import os os.system('setfont Lat15-TerminusBold14') mL = LargeMotor('outB'); mL.stop_action = 'hold' mR = LargeMotor('outC'); mR.stop_action = 'hold' print('Hello, my name is EV3!') Sound.speak('Hello, my name is EV3!').wait() mL.run_to_rel_pos(position_sp= 840, speed_sp = 250) mR.run_to_rel_pos(position_sp=-840, speed_sp = 250) mL.wait_while('running') mR.wait_while('running') This video was made on a Windows PC but the content should be very applicable also to Mac OS and Linux machines.
(English and French subtitles available.) UPDATE: EV3 Python version 2 was released after this video was made. It brings huge improvements – read about them on ev3python.com. Before watching this video you should watch the sister video at http://youtu.be/cqtRqsI6xMc about writing and running EV3dev Python scripts. Putting the EV3dev operating system on an SD card in your Lego EV3 robot makes it possible for the EV3 to run scripts written in Python, one of the world's most popular programming languages. See http://ev3python.com and http://ev3dev.org. This video shows how to set up your EV3 robot and your computer for EV3dev Python programming using the Microsoft Visual Studio Code editor with the EV3 extension. The 12 main steps are: 1. Obtain a suitable microSD memory card. 2. Download the latest Linux Debian Stretch ev3dev image. The 27 July 2018 Stretch image seems to be 'broken' so please avoid that particular image. 3. Download and install Etcher, a free utility that will allow you to flash the ev3dev image to the microSD card. 4. Use Etcher to flash the image to the card. 5. Insert the card into the EV3, boot the EV3, do some minor configuring and establish a connection to the computer via USB, WiFi, Bluetooth or Ethernet. 6. Download and install Microsoft Visual Studio Code (VS Code). This is a free multiplatform code editor, compatible with Windows, Mac OS and Linux. 7. Write and run some non-EV3 Python scripts. 8. Download and unzip the starter project. 9. Open VS Code, open the starter project folder and install two extensions. 10. Configure VS Code. 11. Connect VS Code to your EV3. 12. Write and run your first EV3 Python script! Links used in this video: The sister video about writing and running EV3 scripts using VS Code (watch that first, before this one) is at https://youtu.be/cqtRqsI6xMc http://ev3python.com http://ev3dev.org Get the latest Stretch image from http://oss.jfrog.org/list/oss-snapshot-local/org/ev3dev/brickstrap Get Etcher from http://etcher.io For setting up a Bluetooth connection see http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-bluetooth Get Microsoft Visual Studio Code from http://code.visualstudio.com/Download VS Code is available in 14 languages. See https://code.visualstudio.com/docs/getstarted/locales#_changing-the-display-language Get the starter EV3 Python project from http://github.com/ev3dev/vscode-hello-python The polygon.py script: t = turtle.Pen() sides=int(input('How many sides?')) for n in range(sides): t.forward(100) t.left(360/sides) sleep(6) The demo.py script: #!/usr/bin/env python3 from ev3dev.ev3 import * import os os.system('setfont Lat15-TerminusBold14') mL = LargeMotor('outB'); mL.stop_action = 'hold' mR = LargeMotor('outC'); mR.stop_action = 'hold' print('Hello, my name is EV3!') Sound.speak('Hello, my name is EV3!').wait() mL.run_to_rel_pos(position_sp= 840, speed_sp = 250) mR.run_to_rel_pos(position_sp=-840, speed_sp = 250) mL.wait_while('running') mR.wait_while('running') This video was made on a Windows PC but the content should be very applicable also to Mac OS and Linux machines.