The purpose of this blog is to demonstrate the process of the software design and the code implementation of the project. To begin with, project design is the transformation of a conceptual idea – the game Treasure Hunt – into logical series of steps to be followed, that help writing the source code easier and more structured. Software design has usually a high level of abstraction, as diagrams are drawn as systems interacting with different components. Each block of the diagram represents an action or an activity, which would be a command line or a function in the script respectively. Software design diagrams are usually drawn in UML, the unified modeling language which is used by software engineers to visualize and control the flow of the software. An abstract diagram of the game is shown below:
Furthermore, a more detailed way to visualize the flow of the code is by the use of flowcharts. Flowcharts represent algorithms by the use geometrical symbols to specify each step, and arrows to specify the direction of flow. The flowchart is similar to the diagram above, however the level of detail is higher. The most important symbols are probably the rectangle, which specifies a command or a function, and the rhombus which specifies a decision. The flow chart that represents the game is shown below:
The next step is to write the code based on the diagrams shown above. The programming language used in this project to write the code is C++. The compiler used to convert the software into machine code is the online ARM mbed compiler, since an ARM microcontroller (MCU) is used. The URL of the compiler is:
Firstly, the Nokia N5110 LCD library must be imported to the program and included in the main header file. This library was given to the students by the module leader. Some written functions were also provided in the library, such as init() which initializes the connection between the MCU and the screen, or clear() which sets the pixels in the screen to low (0). An object could be created from the N5110 class, which would act as the path to use the functions in the .cpp file of the program.
In addition, doxygen is used to add comments in the source code. Doxygen is a standard tool for generating documentation for the source code. Comments are very important in software development as it helps the programmer remember his code and develop it, and it allows others who read the code to understand it. The documentation of the functions used in the project is shown in the figure below:
Functions are very important when writing code, as they provide significant advantages. Not only they can be called anywhere in the program, but they also maintain the main tidy, and well-structured. The hero function is shown below:
The function which provides guidance to the hero is shown above.
The functions shown in the blog are not the last version of the code and they could be updated. More functions will be shown in further blogs.
To conclude, the aim of this blog was to demonstrate the progress of the software aspect of the project. Software design diagrams were displayed which contained a high level of abstraction, however they provide a visual feedback of the flow of the program, and make the software easier to implement. An introduction to the code implementation was done and some written functions of the project were shown.