Giter Site home page Giter Site logo

vscode-hello-python's Introduction

vscode-hello-python

Hello World for ev3dev + Visual Studio Code + Python

Overview

This is a git repository to help you get started programming a robot using ev3dev in Visual Studio Code using the Python programming language.

Prerequisites

  • LEGO MINDSTORMS EV3, Dexter Industries Brick Pi, Mindsensors PiStorms, or FatcatLab EVB with ev3dev installed. Does not work with ev3dev-jessie! Be sure to grab a snapshot image of ev3dev-stretch.
  • A computer (Windows, macOS, or Linux) with Visual Studio Code installed.

Step-by-Step

  1. Download the vscode-hello-python project from GitHub and unzip it.

  2. Open the vscode-hello-python-master folder in Visual Studio Code.

    screenshot

    screenshot

  3. Click Show Recommendations when asked.

    screenshot

  4. Install the ev3dev-browser extension. If you have Python installed on your computer, you can install that extension too. (Don't install it if you don't have Python already installed.)

    screenshot

  5. After installation completes, click Reload and Reload Window.

    screenshot

    screenshot

  6. Open the Explorer activity pane.

    screenshot

  7. Click the arrow next to EV3DEV DEVICE BROWSER to open it.

    screenshot

    screenshot

  8. Ensure that your ev3dev device is turned on and has a network connection to the host computer. USB, Bluetooth, Wi-Fi or wired will work.

  9. Click the text where it says "Click here to connect to a device". A box will pop up that lists discovered devices. Select one.

    screenshot

  10. Once the device has connected, you will see a green dot and the /home/robot folder.

    screenshot

  11. Press F5 to download the program and run it.

  12. The Output pane will automatically open and show the status of the program and any error/debug messages.

    screenshot

  13. Open the source code file, hello.py, to learn more.

Code Completion

To get code completion working and fix errors like "Unable to import 'ev3dev2.motor'" you will need to install Python and the python-ev3dev package on your computer.

  1. If you don't already have Python installed, get it from https://python.org or your favorite package manager (Chocolaty, Homebrew, Apt, etc.).

  2. Then set up a virtual environment. You can type these commands on the built-in terminal in VS Code.

    On Windows (make sure you are using CMD, not PowerShell):

    py -3 -m venv .venv
    .venv\Scripts\activate
    python -m pip install --upgrade pip
    pip install python-ev3dev2
    

    Or non-Windows:

    python3 -m venv .venv
    . .venv/bin/activate
    pip install --upgrade pip
    pip install python-ev3dev2
    
  3. In the VS Code command pallete, run the Python: Select Interpreter command to select the .venv folder that you just created.

    screenshot

vscode-hello-python's People

Contributors

dlech avatar olaf500 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.