Pascal a programming language , its history and some example code.

Pascal Programming Language

Pascal Programming Language

Pascal is just one of many programming languages that you can select in order to learn programming skills and then for developing professional applications.

This Wiki page details much about the language of Pascal , Pascal was named in honour of the French mathematician and philosopher Blaise Pascal, it was developed by Niklaus Wirth, who had previously helped with the development a language called ALGOL. You can check out the full details on the link.

I have had a long involvement with Pascal and still love coding in it today, it has had a long development path moving from a structural languages into object orientated coding methods. Today you can program in pascal using visual aids such a Delphi or/and Lazarus, programming interfaces that allow you to design an application starting from the screens that you will present to the user of your finished application, I will post on these methods of coding in the future.

I personally like Pascal a lot, one of the main reasons is that it is a very highly structures and direct language, both to code with and also read through in order to make later changes. Finding coding bugs long forgotten about and maybe only just discovered is helped very much when the language used is very clear in its syntax.

Pascal was developed in the same era as c/C++ and uses much of the same methods , such as external libraries of predefined code ( Units in Pascal, Libs in c++ ).

Pascal more than c++ is a very clear and clean language with fully descriptive commands and statements , C++ is much more symbolic !


user input and output commands in c++ :

cout << “Enter the temperature in Celsius:”;
cin >> celsius;

user input and output in Pascal :

writeln('Enter the temperature in Celsius : ";

It’s not that c++ is impossible to read ,once you fully understand all its syntax its just that its not as easy !

When you have large programs to read through, it becomes much clearer as to why a less symbolic and a more linguistic language is easier to follow and to debug than a sometimes highly symbolic language like C++ .

Student(char *pName, int xfrHours, float xfrGPA)
cout << “constructing student “ << pName << endl;
strncpy(name, pName, MAXNAMESIZE);
name[MAXNAMESIZE - 1] = ‘\0’;
semesterHours = xfrHours;
gpa = xfrGPA;

The only down side to this, as far as a language like pascal is concerned is that you do have to use the keyboard much more when you are writing the actual code in the first place, with each command being written with a much longer form of syntax.

Example pascal code

Below I have uploaded a basic Pascal program , it is designed to request two numbers from the console in Linux or the command line in window and then tell the user which of the two numbers entered is the largest – Simple YES !!!

Simple right !! but you would be amazed just how often that these very simple routines are used in a application, e.g. for sorting large volumes of data or making basic decisions, most of the time computers do not do very interesting things , they just do them very quickly and very often!

Finding the larger of two Numbers

The following is an example of a free pascal program, it includes all the following lines,
I have included a full description in the program comments .

Program exFunction;

(* This program requests two numbers from the user and
   returns the highest of these two values    

    Nigel Borrington 2015     *)


(* Integer Variables =
*   firstnum , the first value entered by the user
*   secondnum , the second value entered by the user 
*   ret , the value used to contain the highest value returned from max

	firstnum, secondnum, ret : integer;
(* function definitions *)

(* Function 'max' tests for the highest of two numbers 
	 passed to it and returns the resulting highest value .			*)
function max(num1, num2: integer): integer;

	(* Local variable declaration *)

	result: integer;
	if (num1 &gt; num2) then
		result := num1
		result := num2;
	max := result;

(* Procedure definitions *)

(* Procedure getvalues prompts the user for two values
   and gets the values of 'a' and 'b' from the keyboard *) 

Procedure getvalues();

	writeln('Please enter your first value');
	writeln('Please enter your second value');

(** main program body **)

	firstnum := 0;
	secondnum := 0;
	(*call the function max to retrieve the maximum of the two values*)
		ret := max(firstnum, secondnum);
		writeln('The maximum value entered was : ', ret);

I intend to come back to this program and use it with other programming languages to show the basic differences between them all ……

In my next post I am going to return to the Pi-face digital devices, installed on the ‘raspberry pi 2’ credit card sized pc, and introduce the python language used to control the (Piface digital 2 i/o board and Piface CAD LCD screen ) …….

Posted in Computer History, Development Languages, Pascal, Programming skills | Tagged , , , , , , , , , , , | Leave a comment

My first weeks with the Raspberry Pi 2 and using BerryBoot OS Boot loader.

Berry Boot 2  Installed on the Raspberry Pi2

Berry Boot 2
Installed on the Raspberry Pi2

First Month with the Pi 2 and Installing Berry boot on the Raspberry Pi

Its been a good month since I received my first Raspberry Pi 2 development board and during this time I have been busy setting it up and testing its features.

Its turning out to be an amazing little computer and the claims that its six time as fast as the Raspberry Pi b+ are a conservative claim at the very least. I am finding that along with Ubuntu’s – Linaro and Fedora 21 / Linux operating systems installed, along with having also tested the Raspberry pi foundations own version of Linux ( Raspbian ), this little single board pc is as fast for many tasks as my Intel atom based desktop pc from Asus, running ubuntu 14.04 LTS.

Clearly!! its not going to be as fast as an Intel i7 pc but do you need all of that speed all of the time ?

Raspberry Pi B 2 Up-boxing and setup

Raspberry Pi B 2
Up-boxing and setup

So far I am very happy with the real world experience of using the Raspberry Pi 2. It is very well able to load all my development IDE’s and design applications along with web browser and play you-tube training videos. I am also having no problems with Loading large PDF’s and dealing with large word-processing documents.

I feel at the very least , I have built a complete development system at an incredible budget with each element costing only around the €45.

I feel that the green pc market is a fast growing one and with these types of systems, you get to find a way of turning off your Intel pc with its energy hungry power needs and use a system that consumes as little as 5v and 2ma – the same as your iphone. Another factor is that these systems run silent, when reading or coding this experience is amazing, a room with no noise at all 🙂

Just so you know these systems use about 1/10th of the power that your pc does even when its power saver mode,  yet you can do many of the tasks you would be doing on a Desktop Pc.

Installing BerryBoot on the Raspberry Pi 2

The biggest advancement with the Raspberry Pi 2 is its move to a quad core Arm7 CPU from the Single core Arm6 CPU in the Pi B+.

This has along with more speed also opened up the possibility of installing much more advanced versions of Linux such as ( Fedora 21 and Lubuntu 12.11 )  Arm  7 versions of the Linux OS. Yet the Raspberry Pi’s own OS Raspbian has also been fully upgrade to take full advantage of the new CPU.

The Raspberry Pi’s own OS boot loader NOOBS, however has yet to include the opportunity to install other Arm7 Linux OS versions, so you need to look elsewhere for the moment and this elsewhere is BerryBoot for the Pi 2

BerryBoot Here <

This has two main advantages over NOOBS :

1.. Fedora 21 and Lubuntu are included in the OS selection list

2.. You can Install the OS onto a USB stick or an even faster USB-Hard-drive or even a Network drive, thus your Micro-sd card is used for the boot partition only ( This is a unique BerryBoot feature on the Pi 2 ).

From the above picture you can see that you first selected the location to format and then install the operating system/systems images on.

Note – Be very careful as to which disk you select for use , as in, make sure its not already being utilised for anything else as this process will clear the disk and delete anything currently saved there.

You are then asked some basic configuration settings questions such as screen over-scan, audio configuration and local keyboard and language settings.

You then select the Operating system or systems you wish to install, (re: “systems” – as you can install more than one OS and dual boot them one at a time).

When the Operating system/systems images have been copied to the root disk you will be asked to name the default operating system, you should still do this even if you have only copied one OS.

Press exit to reboot…

The system will then reboot into the operating system selections screen, which gives you time to make an OS selection, pressing enter or it counts down and then boots your default OS.

Well that’s how to install and use Berryboot for the Raspberry Pi 2, I would highly recommend it as it allows you to boot more Arm7 Linux versions than NOOBS, with their more professional features and it also lets you boot from much faster devices than Micro Sd cards.

As an example the Pi2 can read a Micro SD card at around 20 megabytes a second but a SATA USB disk can be used in excess of 100 megabytes a second , so its well worth considering this approach !

Now that I have my first weeks with the Rasoberry Pi 2 over I can now return to posting a few times a week. My next post will cover Programming languages and which ones are the best for learning coding with, including “Free Pascal” and its IDE Lazarus.

Pascal is a programming language that is making a strong comeback in many universities as its clear to understand and document and very elegant in its layout and structure. It is fully maintained and supported with regular updates including Pascal UNITS for the Raspberry pi and other Development boards GPIO output, so it can be used like Python to control external sensors, lights and motors.

Free Pascal, Next Post ……..

Posted in Development boards, Linux, Operating systems, Raspberry pi, Single board computers | Tagged , , , , , , , , , , , | Leave a comment

Learning application programming ( Action related V Object related)


Sample Object Orientated code

Why is learning to code these days so hard ?

If your just starting out trying to learn how to write application code it will not take you long before you hit one of the biggest walls and choices to be made, this being do you learn Procedural or OOP(Object Orientated) – programming. Having to make this choice however has not always been the case.

I can clearly remember the moment I first read about Object orientated programming it was in a 1990’s copy of the British magazine PC-WORLD, during one dinner time. I had finished making some lunch with a cup of tea and opened the articles page. After I had finished, I put cleaned the then empty cup closed the magazine and returned to my desk.

My first reaction to the initial concepts which had been very well outlined, was to dismiss this information as just another completely unnecessary addition to the core of application development. At the time there was a lots of so called programming aids – newly available , including GUI based development aids that just failed to work and cost a lot of time before being confined to a shelf.

Today in 2015 even though I have embraced Object Orientated coding a lot more than back then, I still have this overwhelming sense that as a whole its an unnatural method for a programmer to develop applications – here is why I feel this way.

Before OOP came into existence, today being included in many of the pre-exisitng, then followed by new programming Languages, Programming code I feel was more natural in its structure, its readability and in its design.

The main claimed difference between procedural code and OOP code relates not so much to the style of the code itself but to how you approach the design of your applications in the first place.

With Procedural based programming, it is claimed that the programmer is first thinking of the actions to be performed before relating them to the data, Actions first then moving onto the type of data needed to produce the required results.

Personally I don’t feel this is the case or ever was the case. Having taken main application specifications and design briefs – before the existence of OPP, the format of the required application data always came first. I worked with designed documents that detailed all the data and its needed format, followed by flow charts etc that detailed all the required actions to be performed in order and on these sets of data.

OOP design states that application design should start with the objects (Data, parameters and arguments – along with placing these features into classes that relate to like minded objects) involved in the application model being developed, only then moving to any actions (Methods! in OOP) to be performed with these elements.

So how to define what really is the main difference between the two coding concepts ?

Procedural programming

With procedural programming you define the data fields to be used in an application followed by the actions you need to perform on this data. Sometimes these actions will result in new data being created ( e.g. Invoice total along with a complete invoice and all its related fields ), this new data is included as a part of the applications initial design.

As its name suggests the flow of these actions is performed in a procedural path of direction, from top to bottom unless otherwise needed, divided into specific functions/Procedures. Core application data is passed between these functions with any data values stored in new resulting data fields, then retained or deleted as required.

With in this flow of actions some of the applications functions/procedures may be needed many times and thus repeated, other actions only being needed once and some actions may not be needed at all in some conditions.

The program code in procedural programming is usually very self contained in that, if you print the code out you would be able to follow the flow of the program depending on defined conditions that can be clearly observed with-in the listing of the code.

Object orientated programming

let’s define a few OOP head spinning terms. The most basic set of vocabulary for OOP is a class, an object, a property, a method, and a parameter. One of the key concepts for OOP is inheritance.

A class is a set of functions that work together to accomplish a task. It can contain or manipulate data, but it usually does so according to a pattern rather than a specific implementation. An instance of a class is considered an object.

An object receives all of the characteristics of a class, including all of its default data and any actions that can be performed by its functions. The object is for use with specific data or to accomplish particular tasks. To make a distinction between classes and objects, it might help to think of a class as the ability to do something and the object as the execution of that ability in a distinct setting.

A method simply refers to a function that is encased in a class.

A parameter is a variable that is passed into a function that instructs it how to act or gives it information to process. Parameters are also sometimes called arguments.

A property is a default set of data stored in a class. A class can have multiple properties and the properties can be changed dynamically through the methods of the class.

Inheritance is one of the keys that make OOP tick. Simply put, classes can inherit methods and properties from other classes by extending them and each class can be
extended by multiple classes. This means that you can start with a base (or parent) class that contains shared characteristics among several classes. That base class can then be extended by other classes (children) that are similar but are meant for slightly different purposes. Any changes in the parent class will automatically cascade to its children.

In many conditions its much harder to read OOP code directly, it is much more like reading someones essay with references to many other books that need to be called upon in order to understand what in full the essay is saying.

Well honestly !!! even for someone who has coded for many years, just reading about OOP concepts is enough to drive you demented with in minutes of starting. Mostly sounding like a dragon consuming its own tail with fire !

When you take into account that OOP was designed to make coding easier, just getting your head around the initial concepts is bad enough.

Having coded for some years before all programmers had to embrace the jump to (Philosophy, Sorry OOP!!!) not just coding! it all feels a step to far.

I will not go into any more OOP details yet in this post anyway !, as I just wanted to outline the fundamental differences as above.

Final comments

What I will say however is that it is worth learning OOP, no matter how painful but you need to take the following into account, OOP coding is not in my belief natural, nor intuitive to us simple humans , it is not easy to document or read once finished, few development aids such as IDE’s can include full help in developing OOP code, while at the same time being perfect for Procedural code.

Yet you still need to learn how to work with OPP! URRRR!

It also needs to be noted that for many areas of coding such as shell scripting(BASH etc…) or Python scripting (not full programming!), OOP code not only has no relevance in many cases its just not possible.

Even after many years in existence you could ask if OOP methods and languages have done little more than add confusion and distraction when coding applications ?

For many it is still a dragon to be controlled. From my own point of view – this is because it is not a natural entity, as I don’t feel that we as humans approach task completion in the form of dividing tasks into (Objects, classes , methods, and Inheritance ), we just don’t!.

We see task as actions to be performed and then we start performing them, we intuitively see something to be completed and only then do we assembly to needed tools.

Can you imagine life , if every time we needed to do something, you viewed the task at hand in such a highly conceptual fashion as to divide it into methods relating to objects. If every time we asked someone to help use with something they spent the first ten minutes telling us how this action was a method that related to all the other objects they had performed these actions on ( Oh its ok , I can do this myself much faster – thank you anyway !!!! 🙂 ).

During life we have to hit many things, hammer other thing in and screw other things down but we do not stop to think how these actions/methods relate to all these objects placed into liked classes, we just get on with the task at hand.

These point however do not diminish the good sides of OOP, I will come to these in following posts and there are many good and great aspects!

I think the best path however is to forget the idea that OPP is there to help you develop easily and quickly , its not, its there to help applications fit into larger structures and wider systems than fast standalone applications.

I just want to finish by saying that OOP is only one option in writing good applications, it should be noted that you don’t have to use it at all – because if your application works, includes all the needed error handling , produces all the correct results well then its as good as it gets.

Another good reason however for learning OPP, is if you intend to work within a commercial setting, as most of the code you will be working with, both correcting or updating will most likely in 2015 be written using OPP methods, so its just one of them times you just have to jump even if the water below you is a little muddy !

Posted in Development Languages, Programming skills | Tagged , , , , , , , , | Leave a comment

Coding with text file editors


VIM/Emacs and other text file editor, details and cheat sheets

Once you get to know the Linux operating system, something that becomes very clear is the need to be able to edit system configuration files along with shell command scripts and programming code in languages such as Python or C++.

As most of this blog is aim at hardware and software development systems such as the Raspberry pi and the cubbieboard, both ARM processor based single board computers, running distributions of Linux OS, I want to explain here which text file editors can be used to best work on these systems.

These details however will not only relate to single board computers, e.g. they would also match an infrastructure based in a Linux server environment and many other configurations.

When looking at the possible editors that are available to the Linux user it is a good idea to think about the environment that you will be using, i.e. Working with a single desktop installation such as Ubuntu 14.04 desktop or working in a networked environment with two or more desktop/server based systems linked by Wi-Fi or wired Ethernet.

Along with these two definitions you need to know if the system your logging in to will even have an ability to login using an attached mouse/keyboard and screen directly. Many cloud/internet server such as (DNS, SQL, NAME-databases and HTML etc…) operate in what is called a headless form, with out any human interface devices attached at all. They are configured and monitored remotely via desktop systems and applications. If you need to sign-in to these systems, then you do so using a secure connection method such as SSH or TELNET.

For example, when I am working with applications and coding on my development boards I have one Raspberry pi set-up with a screen and a keyboard/mouse and two running headless, as I can login to the other two using the installed TCP/IP connection services of SSH and use all the applications on them that I could possible need.

With SSH you get two possible connection options, to connect using the command line only mode, giving you access to text based applications only and secondly using a mode that gives you access to X-11 based GUI applications running in a graphical mode.

To do so you use SSH as follows

Text based Login : SSH # ( User name and TCP/IP address )

X11 based login : SSH -X

In both the above you are presented with a text based command line at login , however with the -X version you can call a GUI based application (e.g. firefox) from this command line.

So how does all this relate to text file editors, well there are two basic type of editors, ones that can be run in text mode only (VIM and EMACS) and ones that run in GUI mode only (GEDIT and NETBEANS-IDE).

If you look in the Linux repository by searching for “text editor”, you will find that there is a large selection to chose from, so I will list just a few here mainly the ones that I use a lot.

I mainly use two as follows :

Text based editors of : VIM, EMACS

GUI editors : GVIM and GEDIT

I will post some details on all of these editors in the future but here I just want to look at VIM and GVIM.

I always find myself using VIM and its GUI version (GVIM) for a very good and simple reason, because its a standard part of the Linux operating system. This is a very important detail – because it means that no matter which UNIX/LINUX computer you have to sign in to , its always there for you.

This is true for the text based version, if you would like to use the GUI version then you need to install one of the three possible packages.

vim-gtk 2:7.4.052-1ubuntu3
vim-athena 2:7.4.052-1ubuntu3
vim-gnome 2:7.4.052-1ubuntu3

I installed “vim-gnome”

The process of learning to use vim/gvim is not a simple one, gvim is a little simpler to learn as it includes the usual graphical menu system of a GUI application , so you need to know less keyboard commands. However I would truly recommend taking a little time to learn the text based version first and it command key combinations, it faster than using a mouse.

In the text based version you have three fundamental modes (View, insert and command), you mostly start in view mode and can return to it by pressing “esc”. In view mode you can used the keys “h,j,k,l” to move around the file, for editing the file you press keys such “r,i,a,o,i” falling into insert mode my doing so.

VIM cheat sheet @

There is no shortage of web pages available that list all the possible modes for VIM/GVIM along with Printable cheat sheets (use google images “VIM cheat sheet”).

Vim contains a massive amount of features, many more than the editors basic front end would let you think, it can be used as a scripting application , letting you changes files in batch mode. Once fully learnt it can be used as a fully featured IDE for almost any coding language going.

When it is used for coding, it is used with configuration files designed for the language you are using, checking syntax along with auto indentation, auto completion, colours highlights and many many other coding features.

The one feature that I like the most when coding with VIM/GVIM this the available command line mode “! command”, which lets you save your code using the “:W path/” command and then call it using “:! python path/” or even compile code using, for example GCC’s ( ASS or GCC ) compiler options, then using the GCC debugger. All this while not having to exit the editor, so that you can if needed make changes , save and then compile/execute/debug again. Coding in Python is very fast as no compiler is needed.

Learn to fully use VIM and you will not regret it in anyway, its available on any Linux installation is powerful and once you know how to get around it very fast to use.

Posted in Linux, Operating systems, Text Editors and IDE's | Tagged , , , , , , , , , , , , , | Leave a comment

Learning Coding skills the fast way

learning programming language’s the best way

ARMcpu Assembly programming using an SSH remote connection

ARMcpu Assembly programming using an SSH remote connection

Learning to program a computer these days is about as simple and yet complicated as it has ever been, when I firsts started coding commercial applications it was on IBM Mid-range and Main-frame computers and to access all the required technical information was a complicated task. IBM printed a complete set of programming language manuals all in A3 format, They were your only source for technical details on each available language command along with some basic details on the structure of the installed Operating systems.

These manuals needed to be supported with off-site training courses and as these could be expensive, they were usually paid for by your employer. I remember that some employers included a clause in your contract so that if you left your employment with them within a year of any attended course you had to pay them back the full cost.

By the time IBM released later mid-range models (2004 -2008 ) of these systems ( i-series . e-servers ) all commercial systems, the methods of accessing study based information and technical details had completely changed. Also these later systems had made the shift to less proprietary development languages, now languages such as (Assembly, C++, Cobol, Pascal, Rexx and Python) were all available. The advantage here was that code for applications and related skills became cross platform.

Today In 2015 there is so much more material available in both printed form and/or on the internet, than in anytime over the last thirty years or so, with shared coding sites such as GIT-HUB, etc…..

This along with Training Apps that share sample code, for Android devices, hundreds of online pdf’s and personal Blogs, it has all been made very easy to self-study and then experiment with your coding.

Another Helpful factor is that almost all of the commercial languages can be installed freely on your own devices, there is little difference between using these programming languages when learning, on even your Android phone or when they are being used on super-computers running with many hundreds of processor cores. Code is code and when your learning it is unlikely that you will see much device related difference.


The Raspberry Pi is a great example of this as you will be missing out very little by developing on this great little machine, in fact it can do many things (Such As GPIO device control) that an Intel I7 pc cannot do. This is the very reason that the Pi has sold over three million units world wide.

Despite all this some of the old problems however still remain ( In an evolved form !) as there is almost too much information available at times, so much so that it is almost impossible to focus and advance quickly in order to learn how to produce finished applications. In an odd paradox, you can find yourself very quickly becoming frustrated with information overload and finding the weeks rushing by while you soak in so much details, while stalling on getting somewhere that truly counts.

So what I hope to do on this site ( A personal Note-pad! ) , while noting some coding skills is to cut to the case a little, yet still note down enough information as to get myself to a point that counts.

For example In the next post/notes relating to coding skills I want to detail the areas in any programming language that exist in most of them, a generic skeleton of the areas that most programming language’s contains from ( Data types to structures, tests conditions and controlling application flow with branching). The reason for this is that selecting a language to learn can in itself be confusing, it can also appear that giving the time to learn a selected language may rob you of the skills needed to learn other ones, who’s attributes are just as required and valuable.

However this concern can be overcome when you understand just how basically alike most programming languages truly are and just what areas they have in common with each other.

Posted in Development Languages, Programming skills, Python, Raspberry pi | Tagged , , , , , , , , , | Leave a comment

PiFace Control and Display

PiFace Control and display LCD Display with multifunction input buttons

PiFace Control and display
LCD Display with multifunction input buttons

PiFace Control and Display

The Piface control and Display was the Final hardware item I needed to get going on implementing the Raspberry Pi ( Python and C++ ) Projects that I have in mind.

Just like the PiFace Digital 2 board, this devices is of the Highest quality and will open up lots of areas I can uses to start to gain some application coding skills.

The Specifications for the PiFace ( CAD ) board are as follows :

– 16 character by 2 line alphanumeric display
– User definable custom characters
– LED display back-light
– IR receiver for infrared remote control
– 3-position navigation switch
– 5 tactile switches
– Quick and easy menu building Python libraries provided
– C++ Libraries

An LCD display using this configuration ( 16 chars X 2 lines ) has been used many times through the history of computerized control systems, used for ( Heating controls, Security systems, Sensor equipment, Alarm clocks, Pagers and Phones etc….) . The reason they are utilized so much is that they use such little power, yet can display just enough information for a user to enter data or configure a device.

One device that stands out in my memory is this 1980’s hand-held personal organizer from Psion UK, but screens like this have been used right up until today.


One project that would be very helpful and in order to make good use of both Python and C++ coding skills would be to re-engineer all the facilities that this old organizer offered, I have down loaded the user manual and am currently starting to produce a chart using “freemind” a Mind Mapping application of all the applications it offered its users.

Another Project I have very much in mind, will involve configuring my two Raspberry Pi ‘s into a networked cluster, with one configured with the PiFace Digital 2 I/O control board and the other with the PiFace Control and display. This will allow me to develop a system that will make use of the LCD display along with its input buttons to control the devices attached to the PiFace Digital Board on the second Pi, such as (Motors, Lights and Switched devices). Again this will allow me to make use of some great and very usable coding and operating systems skills.

Posted in Development boards, Hardware construction, Raspberry pi, Single board computers | Tagged , , , , , , , | Leave a comment

Andriod 4.4 on a HP 550 Laptop, Second Life Projects….

Andriod on a Laptop

Android Development and Second life projects

As part of my up upskilling projects, something I have been wanting to complete for a while is to port Andriod 4.4 KitKat to ether a Desktop or Laptop PC.

To do so opens up all kinds of possibilities, for starters any version of Android that is user installed can be rooted or is rooted by default, giving full access to all system services and files. You get full access to larger disk storage/DVD drives, Mounted USB devices and wired network ports, physical keyboards/Mouse and HDMI screens ( creating a media center if attached to your TV )- all increasing your flexibility when using Android to code applications or make much better use of all the applications in the Google Play store and from other direct sources.

This is also a great method of Second life-ing an old computer, here I have made use on a HP 550 Laptop with a Dual core 2.4Ghz processor, 4Gbytes of Ram and a 500gb hard disk. When considering that Android is a very efficient Version of the Linux Operating system these specifications out perform most of the current hardware that it is designed to run on.

Yet MS windows 8+ is to slow to use these older machines ?????

This is well worth doing if you have a spare somewhat aging computer and it will allow you to get going developing applications in Python or C++ and Java without all the limits of trying to do so on a Table PC.

Finally There are many Android apps that I am looking forward to making full ( With a full keyboard and screen ) uses of including Creative Photography applications, Remote control using SSH/FTP connectivity services, along with remote process control. Connecting to development boards such as the Raspberry pi and Cubieboard ARM CPU systems. The other benefit is that I can sync and backup all my data and code stored on my Nexus 7 Tablet.

Posted in Android, Hardware construction, Operating systems, Python, Second life Hardware | Tagged , , , , , , , , , , | Leave a comment

Piface in a case.

Element 14 , Piface installed with a matching case

Element 14 , Piface installed with a matching case

Piface in a case

During the week I received the very exciting “Piface Digital 2” I/O interface board from New-IT in the UK.

It was clear while setting up the card with the Raspberry Pi b+ that the two together could not be used while contained within the original case that I order to match the Pi B+. At first I considered just using the two boards free style but as with the main system board by itself I just did not feel happy doing so.

I found the above case available on E-Bay and as you can see it fits perfectly with the Pi B+ and Piface together, offering access to all the terminal input and output connectors along with the relay terminals.

I know I now at least feel safer using the system again and its great to use this way.

Posted in Development board hardware, Development boards, Raspberry pi, Single board computers | Tagged , , , , , , , | Leave a comment

Well it is here , The Piface Digital 2 – I/O board.

PiFace Digital 2 Installed on the Raspberry Pi B+

PiFace Digital 2
Installed on the Raspberry Pi B+

As ever, a part I ordered from NEW_IT in the UK arrived with lighting speed this morning !!!

With just lunch time available, I had a quick but very successful go at installing the Piface board onto my Raspberry pi B+, I will try it on my Pi B2 in the future but at present, I very happy using my older model.

I used Thomas Macpherson instructions and they worked first time so a big thank you to him !!!

As with all the Raspberry Pi hardware and software I am very impressed with how stable everything is and how well constructed these devices are, when you consider the price point- this is as good as it gets!!

There is a great front-end application called the “pifacedigital-emulator” (Which can be called through an SSH -X session, allowing you to test the board from another system!) that lets you manually turn on and off all the eight LED’s and the four switched . plus two relay’s.

Using Thomas’s instructions you can very quickly write a Python Module to test if any of the four switch’s have been pressed along with turning on or off the eight LED’s on the PiFace itself. He includes a downloadable Python module that played with the LED’s, for some basic lighting effects and uses the PiFace’s switches to control the app, along with it’s exit.

One quick project I am already considering is an application using the eight LED’s to display Binary numbers converted from Decimal’s, starting by using the on-board LED’s then moving to an external set of LED’s or bulbs.

The eight on board LED lights so however do have a integral function relating to the board , being used to show when you have activated one of the eight output device ports, e.g. sensors or bulbs (The output device ports are marked as yellow and are above the LED’s , in the above image). You can manually test attached devices using the emulator application without doing any coding.

The Piface-Digital 2 board has the following specifications :


Plugs directly onto the Raspberry Pi GPIO socket
Fits Directly over the Raspberry Pi and within the Raspberry Pi’s footprint
2 Changeover Relays
4 Tactile Switches
8 Digital Inputs
8 Open-Collector OutPuts
8 LED Indicators
Easy to program in Python, Scratch and C
Graphical Emulator and Simulator
Relays can be used to switch voltages up to 20V (Max) or currents up to 5A (Max)

So after taking a quick look – all looks perfect and is working just great !!

I cannot wait to get started !!

Posted in Development boards, Hardware construction, Python, Raspberry pi, Single board computers | Tagged , , , , , , | 1 Comment

Lets talk Flow charts and the art of Pseudo-code

Classic Flow chart Created using DIA, design software

Classic Flow chart
Created using DIA, design software

Talking Flow charts and Pseudo-code

Before you learn any computer programming language its always a good idea to first learn what they will be used for and just how you will be using them to write applications.

Whether you use a low level language such as Assembler or a High level Language such as Python or Visual Basic – with is forms and other objects. The processes you will be trying to perform using your code and during executing a completely finished application, will most likely be used to the same effect, which ever language used. As a personal opinion, the selected programming language used is only the method by which you ask the computer hardware to perform defined processes. As such it is these processes that are needed to be defined before you even touch a single key on your keyboard.

Just as with anything you personally are doing in your life, your actions can be broken down into a set of basic processes, usually however you don’t have to write or chart these processes down before you perform them, as most things have become second nature to you. To a computer system these stores second natures and instincts are the programs that you or others have written and then called upon under different existing conditions.

Traditionally their are two methods of charting and defining an application and its processes ( the things it will do and how it will do them ). Both methods can be used individually or along side each other as application design aids.

I use these method together but in the following order :

1.. Using what is called Pseudo-code you can first write down a series of actions to be performed, using your own words. There is no need to think that you have to write in a style or language different from your usual method of talking or writing. Keep things very simple and make sure that someone else can very easily read what you have written, so that they can follow what you intend your designed actions to be.

Here I have used an example of someone watching TV at home when the power goes out in the house, using Pseudo-code to define the actions needed to solve the real issue.

I feel its very important at the start to also define all actions that are currently being performed followed by the actions that need to be performed.

Your sitting watching TV

You Notice the power has gone out

You need to find out why

Find and start to test if the mains fuse has burnt out

Has the fuse has burnt out ?

If so – Replace it , turn on the switch and get back to your program …….>

Has the power also gone out down your street ?

If it has – then report this to the power company or local provider, wait until they get it back on …….>

Is the power still on up your street ?

If so then – call a local electrical expert and wait for him to fix your problems …….>


I use some basic personal conventions here , Using a ” ? ” for a test and a “…..>” as a exit point to the full procedure being performed (i.e. you need to test the fuse box = ” ? ” and you have replaced the fuse so no other actions need to be performed “……>”

2.. Using Flow Charts

Classic Flow chart Created using DIA, design software

Classic Flow chart
Created using DIA, design software

This is the flow chart above used to chart out the same power outage issue and the possible solutions as the Pseudo-code definition.

There are many flow charting applications available, I use an application that can be found in the Linux repository called DIA. You can find your own and get to learn how to using it for a flow chart diagram.

The Reason that I produce a flowchart after the Pseudo code is a simple one, its that – it is far easier during placing your thoughts ( Needed process and actions! ) down on paper or typing them into a text editor , to move or delete lines of text than it is to move the graphical flow chart objects around. Sometimes these graphical objects don’t move into other locations very well and you may be spending ages trying to do so. So Pseudo code with text only first!!!

I will let you do your own reading on flow charts and how to use them, that’s far to much for this simple post !!!

I truly recommend that even if every bone in your body just tells you to get on with coding an app in the language you love the most, that you try these methods here out. You will be amazed how fast your coding will become once you know what your application design really is !!!

In two years time when you have been using an app and trust it, yet want to make changes to it, but cannot remember what its overall design is, that these methods will pay off big time !!

Some may ask why not just use good comments inside your code ? , something you should do anyway. The facts are that an application can contain many thousands of lines of code by the time it is finished and if you are using an object orientated coding method where program flow can be a little obscure at times – well good luck with reading your way through, with many cups of coffee to help.

Its a great idea to have as a flow chart or a pseudo code document , you will find your way within moments and make your changes even faster BUT dont forget to update your charts and Pseudo code 🙂 🙂

Posted in Development Languages, Programming skills | Tagged , , , , , | Leave a comment