Pi, Linux and C Training

I recenty ran a 2-day course for someone who was keen to learn more about Linux, C and the Raspberry Pi.

Teaching isn’t new to me, I’ve run courses on my telephone systems, various aspects of Internet operations for people like web design companies and even used to teach something called Engineering Computing during my years at Napier, so to run a 2-day course in my office wasn’t hard and turned out to be a very rewarding experience for both myself and my student!

So what did we do? Started with getting more to grips with the Linux command-line, the use of pipes and redirection. Demonstrating that programmers are lazy (ie. command and filename completion!) We then went on to look at C programming. My student had been doing some C already, but wanted to learn a bit more. Variable scope – the difference between local and global variables. Static variables and so on. We moved on to separate compilation and linking files together – how we can use header (.h) files to give the compiler “hints” about how to call a function in another file.

We also moved on to some of the wiringPi functions too. Talked about concurrent programming and had a brief introduction to threads (with the simplified thread library inside wiringPi).

So a very worthwhile 2 days – it’s always good to share knowledge and meet more like-minded people too, and I’ve just sent my student some homework 😉


Pi, Linux and C Training — 9 Comments

  1. Hi Gordon… (1) do you have the course material… is it possible to share with us?

    (2)To understand GPIO in Raspberry Pi which is totally new to me… I bought Arduino Uno with starter kit from Adafruit and now able to some fundamentals… hope to join in harcore GPIO discussions in future. My question… is it possible to write and run the code for arduino from terminal window in linux.. if yes… small tutorial please.


    Jishnu – Muscat – Sultanate of Oman.

    • Hi,

      Yes, it’s possible to do Arduino code from the command-line and upload and run with Arduino output going over a serial line. It’s not Pi specific though, but since the Pi is Linux, then it works just fine on the Pi, and as it’s the way I do my arduino code, then it might be worth a writeup!

      Actually, possibly examples of the same (or similar) programs running on each device might be worthwhile at some point too.

      As for the course material, it was very tailored for the person I was training, so not too general, but possibly in the future I might put together some sort of standard modules, etc.


      • Hi,

        for programming in command line in linux… i write the codes in nano and save it as say test.ino .

        Now in gcc we give command as gcc test.c -o test…
        ./test … which runs the program…

        in case of arduino what should be done? I tried arduino test.ino – o test then ./test… but this didnt work!

        any suggestions….

        Jishnu – Muscat – Sultanate of Oman.

        • For the Arduino: You edit your program as before, however you need to compile it using avr-gcc, then you need to link in the ATmega standard C library, then upload the resulting .hex file to the ATmega then hope for the best…

          It’s nowhere near as easy as running a program directly on the Pi (or any other Linux host), but like anything like this, if you can do it once, then you can do it a million times! If I have some time in the next few days I’ll put together an example.


          • That would be really nice… and looking forward for the same…ASAP

            Jishnu – Muscat – Sultanate of Oman.

  2. Hi Gordon

    Thank you very much for the 2 day course last week it was very well structured and has been massively helpful in getting me started with Linux and C – I have done the homework and it all worked fine. I could not have done it without last week !

    I now know where to look for information, how to start writing C programs, how to use and write header files along with the using wiringPi to sort out the GPIO pins on the Raspberry Pi.

    I have been a Windows user for 20 years BUT now have a Linux machine that I understand and with the Raspberry Pi it has sparked off my interest in hardware and software again.

    Thank you also for the very kind hospitality that you and Rachel gave me.