Feb 14, 2015 - Cmake for Arduino and Clion

Cmake for Arduino and Clion

For a project I just started working on I wanted to use Clion with Arduino, since there is no Arduino plugin or support for Clion yet I had to figure out a way to do this with Cmake. In this post I'll try to explain what to do.

Required resources

Ofcourse the Arduino SDK needs to be installed and a Cmake library is required. For this I found Arduino Cmake which can be found at https://github.com/queezythegreat/arduino-cmake.

The project

So lets get started. First create a project directory, mkdir ~/workspace/ArduinoCmake and move into the directory. cd ~/workspace/ArduinoCmake. Let's get the toolchain by going a git clone git@github.com:queezythegreat/arduino-cmake.git This will get the CmakeFiles needed to do arduino related tasks like uploading it to the Arduino. Next we create a source file: nano main.cpp in this file we put a simple demo:

#include <HardwareSerial.h>

#include <Arduino.h>

int incomingByte = 0;    // for incoming serial data

void setup() {

    Serial.begin(9600);    // opens serial port, sets data rate to 9600 bps

}

void loop() {
    // send data only when you receive data:

    if (Serial.available() > 0) {

        // read the incoming byte:

        incomingByte = Serial.read();

        // say what you got:

        Serial.print((char)incomingByte);

        }

}

This demo will do a serial echo so we can send data to the Arduino which it will echo back. Next we create the CmakeLists.txt: nano CMakeLists.txt and in this file put the following: cmake_minimum_required(VERSION 2.8.4)

set(CMAKE_TOOLCHAIN_FILE arduino-cmake/cmake/ArduinoToolchain.cmake)

project(projectName)

set(ARDUINO_DEFAULT_BOARD mega)

set(ARDUINO_DEFAULT_PORT /dev/ttyUSB0)

link_directories(arduino-libraries)

generate_arduino_firmware(projectName

    SRCS main.cpp

)

I will highlight the important lines: The set(CMAKE_TOOLCHAIN_FILE line tells Cmake where the Arduino toolchain is located. This line must be before the project line. The next lines, ARDUINO_DEFAULTs, tell the Arduino toolchain which board is used and on which port it is located. In the generate_arduino_firmware command we tell the toolchain which sourcfiles to use.

Building the project

To build the project create a build directory: mkdir build and move into it: cd build. Next use cmake to build the project: cmake ../ and this creates make file. To build the project use make and to upload the project use make upload

Feb 14, 2015 - Honours Weekend

The Honours weekend

This weekend the IT students and alumni participated in a hackaton like weekend. A weekend filled with fun, drinks, programming, presentations and more. In this post, which will be updated during the weekend I'll try to capture the vibe we have here on the island called Terschelling.

This post is work in progress and will be updated multiple times this weekend.

The Location

One of our sponsors offered us the location namely Hotel De Walvisvaarder on Terschelling. They kindly offered us the rooms and meals to use. This beautiful location on the Island of Terschelling. This is one of the island in the Netherlands.

The program

To have some guideline on what would happen during the weekend the guys organizing it created a program. The program started on Friday the 13th at 09:55 with the departure of the boat and during the rest of the day presentations were planned as well as the pitching of some idea's. Friday night after diner teams formed and the hacking started, more on that later.

On Saturday one more presentation interrupted the work-flow, even though this presentation was on the subject of work-flows namely agile working. The rest of the day was filled with programming, hacking, games and other stuf which happens when you put 16 programmers in one room.

The Projects

Jan 25, 2015 - This is the first post using Jekyll and github pages.

This is the first post using Jekyll and github pages.

As of now the site has been migrated to github pages. The main language will be English, though some posts might be written in Dutch due to the subject or if they are older

Migration and updates

In the coming days and weeks the old posts will repear here and the site will be updated.