Установка и настройка Code::blocks на Banana Pi, Orange PI и Raspberry Pi под Ubuntu
Установка Code::Blocks IDE на Ubuntu 16.04 Mate
В дальнейшем, для работы с WiringPi на языке C/C++, нам нужен будет IDE. Так как я не люблю писать в блокнот и потом компилировать всё это в терминале, мы установим Code::Blocks IDE.
И так, для начала необходимо установить компилятор gcc и g++. Как правило, оба компилятора уже установлены разработчиками ОС Ubuntu. А если их на вашей ОС нема, тогда установите оба компилятора так:
С этими компиляторами можно компилировать программы в консоли, также ими пользуются среды программирования такие как Code::blocks.
Code::blocks тоже можно установить через терминал:
Создание нового проекта WiringPi в Code::blocks и его настройка
- Для начала проверяем установлен ли WiringPi:
Вы должны получить примерно такой результат:
В противном случае перейдите на страницу Установка и настройка WiringOP/WiringPi на Orange Pi PC или Установка и настройка BPI-WiringPi/WiringPi на Banana Pi где есть инструкция по установке WiringPi.






Компилятор выдаёт ошибки типа:
undefined reference to ‘wiringPiSetup’;
undefined reference to ‘pinMode’;
undefined reference to ‘digitalWrite’;
undefined reference to ‘delay’;





Установка code blocks на raspberry pi
Устанавливаем Code::blocks
Нам понадобятся компиляторы gcc и g++, встроенные в Ubuntu. Если вдруг их там нет, то ставим так:
Если и Code::blocks в Вашей системе нет, то ставим и его:
Создаём новый проект WiringPi в Code::blocks
Если WiringPi у Вас тоже нет, то ставим его:
Далее запускаем Code::blocks
Далее можно выбрать разные проекты, но нам подойдёт Console application
Затем можно выбрать язык программирования. Лично я выбрал С++
Задаем имя и путь для проекта в графах «Project title» и «Folder to create project in» соответственно
Теперь нужно выбрать компилятор. Чуть выше мы поставили GNU GCC Compiller, поэтому выбор падает только на него
В main.cpp вставляем эту простую программу для примера:
Далее жмём F9, чтобы выполнить компиляцию
Как мы видим, появились ошибки (на фото выделены красным снизу), чтобы их исправить, заходим в опции:
Далее заходим в Linker settings
Сохраняем. Для компиляции и выполнения снова жмём F9
ryaneverett33/CodeBlocks-Raspberry-Pi-Addons
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
CodeBlocks Addons [R-Pi]
Easy Cross Compilation for the Raspberry Pi from the Code::Blocks IDE. Tested and working on Ubuntu 14.04.
You must have the GCC Compiler installed on your linux device prior to installing this. Code::Blocks will be unable to locate the compiler if you don’t. Information about installing the compiler can be found here: Elinux.org. If you’re on Ubuntu, this can be accomplished by running in terminal: »»term apt-get install gcc-arm-linux-gnueabi make ncurses-dev »» Then simply follow the instructions for installation.
Close down Code::Blocks before starting. Open Files with root priviledges.
Navigate to /usr/share/codeblocks Open the «compilers» folder and copy «compiler_rpi.xml» and «options_rpi.xml» into it. Close the «compilers» folder, open up the «templates» folder, and then open the «wizards» folder. Copy the «raspberrypi» folder into this folder. Open Code::Blocks and click FIle > Create a new Project. Right-click in the white space and click «Edit global registration script». Add the following lines to the script in the «RegisterWizards» function.
Save, Close, and then Restart Code::Blocks for the project option to show up.
The Compiler only compiles C scripts, any scripts compiled in C++ will not execute. Writing in C++ is forbidden. [FIX-ME] Upon creating a project, Code::Blocks will warn about three wizard errors, continue as normal. Projects still compile.
About
Simple Cross Compilation for RPi from Code::Blocks
Установка code blocks на raspberry pi
Hello Everyone; in this topic i will talk about http://www.raspblocks.com/
Raspblocks is a code generator for Raspberry boards. You don’t need any coding skills to program it and make your projects.
Have Fun
Re: Easy Way to code Raspberry with blocks
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors — are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: Easy Way to code Raspberry with blocks
If you try it out in the last link — it seems to generate runnable Python code
Very nice work
Re: Easy Way to code Raspberry with blocks
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors — are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: Easy Way to code Raspberry with blocks
the answer is «runnable python code».
but even when it wouldn’t, it gives us choices.
great work pi_amateur, and don’t mind dougie, he can be a bit negative sometimes.
Re: Easy Way to code Raspberry with blocks
No harm in having other options.
Long standing forum member @AllAboutCode has a similar offering at http://edublocks.org/
The website for edublocks looks more polished to me, and it is capable of generating code for a micro:bit as well as for an RPi.
Re: Easy Way to code Raspberry with blocks
With so much pre-existing choice why do we need a new website to do the same stuff we can already do?
The proliferation of programming languages is one of the great problems with the software industry. We’ve got a wheel that’s already had the corners knocked off, why do we need snow tyres when it’s not snowing? Do we really need a re-spin of an existing thing every week?
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors — are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: Easy Way to code Raspberry with blocks
Yes, yes we do. Because some tools work better for some people. I’ve been having quite a bit of fun using Blocks with a micro:bit, so I really want to give this a shot. But I’ve also seriously tried shell scripting in PostScript¹, something I don’t think anyone else would even want to try or use even if they had to.
I mean, I check the Days Since Last JavaScript Framework site frequently. I know it’s absurd. But there are sometimes some neat ideas that come out.
¹: PostScript: a page-description language notable for using stack-based notation and mixing code and data all in the one stream, but it can be coerced into doing file operations. You’ve probably got the GhostScript (gs) PostScript interpreter installed on your Raspberry Pi already. The tiny PS program ‘1 1 10 < == >for’ will print the numbers 1…10. Adobe’s PostScript Language Tutorial & Cookbook (search for «adobe blue book») is freely available if anyone feels like trying this somewhat niche language.
Update: seems I accidentally linked to a js bitcoin mining site. Sorry about that; link removed. Was hoping to find the cartoon of the same name.