A Python to NXC Converter for programming LEGO MINDSTORMS Robots
pynxc on GitHub is a continuation of a now stale project to convert Python programs to NXC so that you can use Python to program your NXT robots.
You can find the official site of the old project here: https://code.google.com/p/pynxc/
- Download and Install the LEGO NXT Fantom Driver from the LEGO Website
- Download and Install Git for Mac from here
- Download a zip or clone this repository to your local computer -
- Make a new folder somewhere in your OneDrive e.g.
NXT Lego
- Open Terminal app
- Type
cd
in the Terminal and drag the folder into the Terminal window - Run
git clone https://github.com/talltechdude/pynxc.git
from terminal to download the Python Library - Run
cd pynxc && sudo python setup.py install
to install the library
- Make a new folder somewhere in your OneDrive e.g.
- Download and Install Visual Studio Code
- Open Visual Studio Code and use
File
->Open Workspace
to open thepynxc.code-workspace
file - Connect your NXT brick via USB
- Open the
src/helloworld.py
or one of the Python files in thesamples
folder - Press
CMD+Shift+B
to build and upload the program to your Robot (this will only work if using the providedpynxc.code-workspace
file)
- There are some sample scripts in the
samples
directory that you can try or learn new functions from
- Full Function Reference
- PyNXC Documentation Wiki
- NXC C Code Tutorials
- NXC C Code Function Reference
- Additional NXC guide
- Not eXactly C Wikipedia
- Not eXactly C API
- A write up of Python-based NXT code
This version is trying to provide an API with which one (in these case especially kids) can program his or her NXT robot easily. The aim of this project is to make this API as Pythonic as possible, so that if programming robots with Python is someone's first encounter with Python they can then jump right into the Python world.