Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HOW-TO GET THE NBC/NXC COMPILER ON THE RASPBERRY PI
- ===================================================
- I assume you are using Raspbian.
- $ cd ~/path/where/i/want/to/install/nbc
- Folder to hold the sourcecode:
- $ mkdir nbc_src
- $ cd nbc_src
- Download the source code:
- $ wget http://freefr.dl.sourceforge.net/project/bricxcc/NBC_NXC/NBC%20release%201.2.1%20r4/nbc-1.2.1.r4.src.tgz
- If that don't work, download the nbc source code from this site:
- http://sourceforge.net/projects/bricxcc/files/NBC_NXC/NBC%20release%201.2.1%20r4/nbc-1.2.1.r4.src.tgz/download
- Make sure you are downloading the latest version of NBC. See all versions here:
- http://sourceforge.net/projects/bricxcc/files/NBC_NXC/
- Extract in current directory, make sure filename is correct
- $ tar xvzf nbc-1.2.1.r4.src.tgz
- Go to the newly created "NXT" directory
- $ cd NXT
- Now you need to install the FreePascal compiler and USB support, for transferring programs to the NXT
- $ sudo apt-get install fp-compiler fp-units-fcl libusb-dev
- Start compiling/assembling
- $ make -f nbcunix.mak
- Copy the executable from the source folder to the parent, and leave the source folder.
- $ cp nbc ../../nbc
- $ cd ../../
- If you want you can delete the source folder:
- $ rm -rf nbc_src
- You can try to see of NBC is working by typing
- $ ./nbc -help
- You should see the help about the tool
- Now let's fix USB support, so you can upload the programs to the NXT directly
- I like using nano, but you can use leafpad or any other text editor
- $ sudo nano /etc/udev/rules.d/71-lego.rules
- Paste the following in that file:
- # USB - Lego Mindstorms NXT
- SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="0694", ATTR{idProduct}=="0002", MODE:="0666"
- SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="03eb", ATTR{idProduct}=="6124", MODE:="0666"
- Press Ctrl+X, write Y (for english) and hit enter. The file is now saved.
- Now run this command to reload the udev rules:
- $ sudo udevadm control --reload-rules
- You can now connect the NXT and start write programs!!
- Example program:
- task main() {
- ClearScreen();
- TextOut(0, LCD_LINE4, "Hello, Raspberry");
- while(1) {}
- }
- To compile a program and run it:
- $ ./nbc myProgram.nxc -r
- Enjoy!
- Please tell me if I missed a step
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement