All Projects → ddemidov → ev3dev-lang-cpp

ddemidov / ev3dev-lang-cpp

Licence: MIT License
C++ language bindings for http://ev3dev.org

Programming Languages

C++
36643 projects - #6 most used programming language
Liquid
124 projects
CMake
9771 projects

Projects that are alternatives of or similar to ev3dev-lang-cpp

pybricksdev
pybricksdev: Python Package with Pybricks developer tools
Stars: ✭ 24 (-58.62%)
Mutual labels:  lego, mindstorms
ocaml-mindstorm
Library to drive Lego mindstorm NXT bricks from OCaml. Communication with the NXT brick is done through bluetooth.
Stars: ✭ 15 (-74.14%)
Mutual labels:  lego, mindstorms
lego-mindstorms-51515-jetson-nano
Combines the LEGO Mindstorms 51515 with the NVIDIA Jetson Nano
Stars: ✭ 31 (-46.55%)
Mutual labels:  lego, mindstorms
drivecommand
A communication library which connects a robot (EV3, NXT, etc.) and a device (Android, PC, etc.)
Stars: ✭ 13 (-77.59%)
Mutual labels:  lego, mindstorms
Lego-Mindstorms
Hints, tips, and tricks for the LEGO Mindstorms products (RCX, NXT, EV3, Robot Inventor).
Stars: ✭ 49 (-15.52%)
Mutual labels:  lego, mindstorms
robertalab-ev3dev
roberta lab connector for ev3dev
Stars: ✭ 16 (-72.41%)
Mutual labels:  ev3dev
node-movehub
Node.js interface for the Lego Boost Move Hub 🤖 🐱 🎸 🚚
Stars: ✭ 57 (-1.72%)
Mutual labels:  lego
ev3dev
ev3dev meta - bug tracking, wiki and releases
Stars: ✭ 610 (+951.72%)
Mutual labels:  ev3dev
pxt-powerfunctions
MakeCode extension for controlling your LEGO Power Functions devices with an IR-emitting LED
Stars: ✭ 44 (-24.14%)
Mutual labels:  lego
l2cu
L²CU: LDraw Linux Command line Utility
Stars: ✭ 14 (-75.86%)
Mutual labels:  lego
epaper-clock-and-more
e-paper clock + weather + AQI + traffic delays - using Waveshare 2.7inch & 4.2inch eink displays running on Raspberry Pi
Stars: ✭ 34 (-41.38%)
Mutual labels:  lego
powered-up
.NET implementation of the LEGO PoweredUp Protocol
Stars: ✭ 65 (+12.07%)
Mutual labels:  lego
awesome-lego-universe
Useful guides, tutorials, and FAQs related to LEGO Universe and Darkflame Universe.
Stars: ✭ 34 (-41.38%)
Mutual labels:  lego
LegoBrickClassification
Repository to identify Lego bricks automatically only using images
Stars: ✭ 57 (-1.72%)
Mutual labels:  lego
lego-boost-app
React Application for controlling Lego Boost from the browser with Web Bluetooth API
Stars: ✭ 57 (-1.72%)
Mutual labels:  lego
AWESOME-LDraw
LDraw — awesome software, file format, parts library and model repository (3D models of LEGO® and LEGO-compatible bricks)
Stars: ✭ 30 (-48.28%)
Mutual labels:  lego
ev3dev-lang
(deprecated) language bindings for ev3dev sensors, motors, LEDs, etc.
Stars: ✭ 56 (-3.45%)
Mutual labels:  ev3dev
assemblme
Iterative object assembly animations made simple
Stars: ✭ 19 (-67.24%)
Mutual labels:  lego
ldview
Real-time 3D viewer for displaying LDraw models
Stars: ✭ 65 (+12.07%)
Mutual labels:  lego
lego-art-remix
Powerful computer vision assisted Lego mosaic creator · Over 500,000 images created (so far!)
Stars: ✭ 148 (+155.17%)
Mutual labels:  lego

C++ language bindings for ev3dev

Build Status

Compiling

  • EV3:
mkdir build
cd build
cmake .. -DEV3DEV_PLATFORM=EV3
make
  • BrickPi:
mkdir build
cd build
cmake .. -DEV3DEV_PLATFORM=RPI
make

You have several options for compiling.

Cross-compiling

You can use a cross-compiling toolchain to create ARM compatible code. Note: You need a Linux toolchain, not a "bare-metal" toolchain. If it does not have "linux" in the name, it probably won't work.

Pros: Fastest option. Works on Windows and Mac without a virtual machine.

Cons: Only includes standard libraries - no Debian -dev packages.

Windows

MentorGraphics toolchain (formerly known as CodeSourcery).

Windows 10

Windows 10 supports the Windows Subsystem for Linux which allows us to install and execute the entire compiler toolchain. The steps required to compile native-mode EV3 applications on Windows 10 is as follows:

  1. Be sure that your Windows 10 installation has Windows Subsystem for Linux installed. First make sure Developer Mode is enabled under Settings --> Update & Security --> For developers. Then, go to Control Panel --> Programs and Features --> Turn Windows Feature On/Off and check the box next to Windows Subsystem for Linux (Beta).

  2. Fire up the bash shell by pressing Start Key, type bash and press Enter. This will open up Bash on Ubuntu on Windows.

  3. Install the ARM compiler by typing sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi.

  4. Use git clone to clone this repository to the directory of your choice, e.g.,

git clone https://github.com/ddemidov/ev3dev-lang-cpp.git

will clone the repo into a directory called /ev3dev-lang-cpp.git.

  1. You need to make some changes to the top-level CMakeLists.txt file. First, go into the directory
cd ev3dev-lang-cpp

Now, edit the CMakeLists.txt file with a text editor of your choice, e.g.,

vi CMakeLists.txt

Just after the project(...) declaration, set the C/C++ compilers by adding the following lines:

set(CMAKE_C_COMPILER "arm-linux-gnueabi-gcc")
set(CMAKE_CC_COMPILER "arm-linux-gnueabi-gcc")
set(CMAKE_CXX_COMPILER "arm-linux-gnueabi-g++")

Alternatively, you can set these environment variables during compilation (explained later).

  1. Now compile your programs and the generated binaries will be ready for EV3. This assumes that you have build tools such as make and cmake installed - if not, install them with sudo apt-get install build-essential (for make) and sudo apt-get install cmake for cmake. You can then perform compilation by invoking the following commands:
mkdir build && cd build
cmake .. -DEV3DEV_PLATFORM=EV3
make

If you did not set the variables in the CMakeLists.txt file, use the following commands instead:

mkdir build && cd build
CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ cmake ..
make
  1. Install gcc-5 from unstable on your EV3, or else files compiled in Windows will not execute. First, on the EV3, edit /etc/apt/sources.list to allow searching for packages in unstable:
sudo vim /etc/apt/sources.list

Append the following lines to the end of the file:

deb http://httpredir.debian.org/debian unstable main contrib non-free
deb http://security.debian.org/ unstable/updates main contrib non-free
deb http://archive.ev3dev.org/debian unstable main

Save and exit. Afterwards, run sudo apt-get update, which will update the packages searched for. Finally, install the new gcc compiler:

sudo apt-get install gcc-5/unstable
  1. The build directory will now contain folders with binary files ready to be executed on the EV3 brick. The easiest way to copy files is to use a program that supports SFTP, such as Filezilla. Remember that, by default, the username of the host system is robot and password is maker. The location of the path where the files are kept on disk is likely the following:
c:\users\<YOUR USERNAME>\appdata\local\lxss\home\<YOUR USERNAME>\ev3dev-lang-cpp\build\

Alternatively, Secure Copy may be used to quickly transfer a few files without having to leave the shell:

scp file.txt <EV3 USERNAME>@<IP>:/destination/directory
  1. Be sure to chmod u+x myprogram for every copied program before running the program, otherwise you'll get an Access Denied in SSH or some really weird error if executing from the brick.

Mac

The Carlson-Minot toolchain provides a complete toolchain for cross-compilation on the Mac. Download the "ARM GNU/Linux G++ Lite 2014.05-29 Easy Installer" and run it.

To get the cross-compilation working, use (replace EV3 by RPI for the BrickPi)

mkdir build
cd build
CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++  cmake -DCMAKE_SYSTEM_NAME=Linux -DEV3DEV_PLATFORM=EV3 ..
make

Brickstrap

Brickstrap uses QEMU to create a virtual environment (not exactly a virtual machine) that can run the same ARM compatible code on a different type of computer.

Pros: Faster than running on the EV3 itself. Can install all Debian -dev packages using apt-get.

Cons: Slower than cross-compiler. Requires Linux (Ubuntu).

See this page for instructions.

On the Brick

It is possible to compile programs on the EV3 brick itself.

Pros: Easy to setup.

Cons: Really slow.

Just run sudo apt-get install build-essential on the EV3 and you will have everything you need.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].