Overview of Content Relevant to the Raspberry Pi
[Networking] [Databases] [Installing a TrueType Font] [Viewing HTML5 files output by Smart Pascal]
[Learning Pascal on the Pi] [Programming in TINY on the Pi] [Programming in C/C++ on the Pi] [SonicPi]
Our most prominent pages on the Raspberry Pi are the Getting Started series in the Resources section. These offer guidance on the setting-up of the Pi and programming in Pascal using Lazarus on the Pi. We provide a list of Pascal programs that we have tested on the Pi and also warn you about types of Lazarus program that will not work on the Pi. Lazarus on Linux demonstrates how you can use fpSystem in the Unix unit instead of ShellExecute in the Windows unit to execute another program. An alternative solution is to use a TProcess as demonstrated here.
Several other sections of the website are relevant to Raspberry Pi users, because they output software that can be run or viewed on the Raspberry Pi. These include Smart Pascal programs that output HTML5 files viewable (with varying the degrees of success tabulated below) using the Chromium browser on the Pi. You can use a web server on the Pi to serve up these pages and/or other html files. Oxygene for Java console and frame-based applications (and their equivalents in C# for Java) will run in a Java Virtual Machine (JVM) installed on the Pi. We have converted these student programs to Oxygene for Java and provide screenshots for some of them running on the Pi: RockPaperScissors, Roulette, Arithmetic, Crossword, RandomNumberGenerator, OnScreenTimer and BankSimulator. All of the .jar files that we have tested run without problems on the Raspberry Pi. This screenshot shows BankSimulator running on the Pi.
BankSimulator on the Pi
James provides instructions for setting up a web server and we have a Smart Pascal demo that accesses (using PHP) a MySQL database on the server. Our Smart Pascal client-server demo comprises a Node.js echo server and EchoClient.html that you download with the Apache web server. Both demo servers run on the Pi.
Remote access to the Pi is also possible either from the command line as instructed by James in SSH and PSCP for the Raspberry Pi and Remote Control of a Raspberry Pi or by Smart Pascal programs that use PHP to query and control the Pi's OS.
SQLite is easy to set up and use. In our main database tutorial we show you how to use a DBGrid with a DBNavigator in Lazarus to enable the user of the application to view, edit, add and delete records.
Both Firebird and node-firebird are suitable for use on the Pi and we provide instructions for installation, examples of use of Firebird with Lazarus (including date and blob fields) and demonstrations of extraction of selected data to a memo, grid and dataset on a web page.
Installing a TrueType Font
Follow these instructions to install the Lucida Console font on the Pi.
- Copy the TrueType file C:\Windows\Fonts\lucon.ttf on your PC to a memory stick.
- Copy lucon.ttf from memory stick to /home/pi on your Pi.
- At the LXTerminal enter the command sudo mv lucon.ttf /usr/share/fonts/truetype
- Enter the command sudo reboot to put the addition into effect.
Viewing HTML5 files output by Smart Pascal
This table reports assessments of the performance of student games written in Smart Pascal and student games converted to Smart Pascal when viewed with the Chromium web browser on the original single core Raspberry Pi. For some you need to install the Lucida Console font as described immediately above.
|Program||Performance on the Raspberry Pi|
|MovingBallWithParticles||Slow, but still worth seeing in action as a preview|
|MaxCircles||Slow, but worth seeing as a preview|
|PlatformDemo||Slow but usable|
|SpaceInvaders||Too slow but worth seeing as a preview|
|RoamingBlockBuster||Slow but playable|
|RandomPlatformScroller||Too slow (some levels running at only two frames per second) but worth a look at the early training levels as a preview|
|TowerOfArcher||Too slow but OK for preview|
|Web version of RockPaperScissors||Fine with the Lucida Console font installed on the Pi|
|Web version of BigFibonacci||Slow but otherwise fine|
|Web version of Functions||Slow but usable as preview with the Lucida Console font installed on the Pi|
|Web version of Battleships||Slow and needs the Lucida Console font; you need to be very patient|
|Web version of Calculator||Slow and needs the Lucida Console font|
|Web version of MazePlus||Too slow and but usable as preview if you install the Lucida Console font|
|Web version of Physics||Slow and needs the Lucida Console font.|
|Web version of MorseCode||Does not work because of audio|
|Web version of Snake||Good|
|Web version of Ascii3D||Very slow and needs the Lucida Console font, but just about works as a preview|
|Web version of Roller||Very slow, but satisfactory for a preview|
|Web version of PixelSort||Slow but fun to play with|
|Web version of WaveInterference||Slow, but OK as preview of graphs|
|Web version of SuperHappyFunLand||Very slow to load and to respond to key presses but does work|
|Web version of FlyingUK||Slow, but fine as preview|
|Web version of 3D-Driving||Slow, but fine as preview|
|Web version of Knowledge||Images slow to load and taxi moves slowly so it is too easy to keep it on the road|
|Web version of My_first_sdl||Fine|
|Web version of Invader||Does not work, perhaps because of audio|
Suitability of Resources and Tutorial Sections for Learning Pascal on the Pi
We have not tested all of our Lazarus code on the Pi, but have been pleased by the success rate of the testing to date. If the code does not work there is usually an obvious reason, such as requiring the Windows unit. We welcome feedback on demonstrations that do not work for no apparent reason.
Delphi, Smart Mobile Studio, Oxygene for Java, and C# do not run on the Raspberry Pi. Getting Started with Pascal on the Pi directs you to the Getting Started with Lazarus series of pages for console programs. When you have mastered them, try Getting Started with Form-based Applications in Lazarus.
Most tutorial sections apply to the use of Lazarus on the Pi. Taking the tutorials in learning order (the order in the left panel of the Tutorials introductory page), all those from Constants and Variables to Operators should be suitable.
Part of the graphics tutorial describes the use of WinGraph, which is for the Windows operating system and not for the flavours of Linux such as Debian on the Pi. Other parts of this tutorial are for Delphi rather than Lazarus.
The next three tutorials (Recursion, Object Oriented Pascal and Sorting and Searching) should apply to Lazarus on the Pi.
Most of the in-line assembler tutorial is illustrated with Intel syntax and AT&T syntax, both of which are for Intel-type processors and not for the ARM processor on the Raspberry Pi. Only the last page, entitled In-line Assembler in Lazarus on the Raspberry Pi, is directly relevant. See also the Raspberry Pi version of CollatzAsm.
The most of the examples in the Translators tutorial are for the Windows operating system and Intel-style processors, and those for the Raspberry Pi are clearly described as such.
The Testing tutorial should be fine in Lazarus on the Pi; automated testing is based the TestRunner unit built into Lazarus. In Debugging we give separate instructions for Lazarus and Delphi so you should find it useful for the Pi.
Although VB does not run on the Pi, VB to Pascal will be useful to those who are learning Pascal on the Pi after VB on a PC.
Most of the examples in Arrays for Enthusiasts are for Lazarus and any for Delphi only are clearly described as such.
In Game Development, follow the instructions for Lazarus.
We have tested the Pascal examples in Language Development with version 0.9.30.4 of Lazarus installed on the Pi.
Programming in TINY on the Pi
We provide a basic IDE to help you program in Jack Crenshaw's TINY language on the Raspberry Pi. The most talented students will be able to tailor the language to their own taste. We describe the changes that were necessary to convert the code generation from Intel Assembler first for the ELF simulator on a PC and then to ARM for the Pi. The bottom of the ARM page has links to the complete code of the TINY compiler for the Pi.
Programming in C/C++ on the Pi
See our tutorial, C/C++ after Pascal. We provide instructions for compiling our sample code with the inbuilt C compiler. See also our advice for installing the C/C++ IDE Code::Blocks on the Pi and notes on its use for compiling published simple server and client programs. Accessing Databases using C directs you to published C programs that we have tested on a Raspberry Pi. See our section on in-line assembler to help you get started with in-line ARM assembler on the Pi.
Hamish created the soundtrack of BounceBlocks using SonicPi (which is pre-installed on the Raspberry Pi).