Solutions to the exercises

This is the page to which the solutions will be uploaded. These will mainly consist of gzipped tar files which you can download and unpack.

Several of the solution packages contain shared libraries the students can use. The idea is to give them a feeling for how the sensors work, before they try to write programs to access the sensor registers by themselves. Of course libraries hide many of the difficult intricacies to give users easy access to most (but usually not all) of the sensor's functionality.
The libraries usually come in 2 files:

  • an include file
  • the share library binary itself
These should be installed in /opt/ucc/include and /opt/ucc/lib respectively and your Makefile for the application using the library should have the option:
  • -I/opt/ucc/include in its CFLAGS
  • -L/opt/ucc/lib in its LDFLAGS
  • -ldht11, if we use the libdht11.so library, otherwise replace dht11 by the name of your library
To allow the system to find the shared library when the application is loaded for running you have 2 options:
  • setup the LD_LIBRARY_PATH to include /opt/ucc/lib
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ucc/lib, prior to running the program
  • create a file ucc.conf with only the text "/opt/ucc/lib" in it and save it in /etc/ld.so.conf.d
    Then run ldconfig. This will include /opt/ucc/lib into the system wide search path for shared libraries
In order to allow the students to access the gpio and the i2c driver you must add their user accounts to the gpio and the i2c groups. This is done with the command: usermod -a -G gpio (or i2c) user_account e.g. usermod -a -G gpio cscgrp1

For the exercise on Linux there are only solutions to the binary calculations as the other exrcises are simple Linux commands to be executed by the bash command interpreter.

-- Uli Raich - 2018-09-17

Commen1ts

Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r12 - 2018-11-27 - UliRaich
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback