Difference between revisions of "Lazarus on Raspberry Pi"

From Lazarus wiki
Jump to navigationJump to search
m (Clarification of startup procedure.)
Line 18: Line 18:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
This installs a precompiled version of Lazarus on the Raspberry Pi. Of course, a network connection is required. Installation may take about 30 minutes, but major portions of this process take place automatically. After installation you may instantly start Lazarus via the LXDE development menu.
+
This installs a precompiled version of Lazarus on the Raspberry Pi. Of course, a network connection is required. Installation may take about 30 minutes, but major portions of this process take place automatically. After installation you may instantly start Lazarus from the "Programming" section of the LXDE start menu.
  
 
===Compiling from sources===
 
===Compiling from sources===

Revision as of 19:30, 26 December 2012

Lazarus on Raspbian Wheezy.
Lazarus on Raspbian Wheezy

The Raspberry Pi is a credit-card-sized single-board computer. It has been developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools. Raspberry Pis are also used for multiple other purposes that are as different as media servers, robotics and control engineering.

The Raspberry Pi Foundation recommends Raspbian Wheezy as standard operating system. However, alternative systems including RISC OS and various Linux distributions, even Android, may be used.

Lazarus runs natively under the Raspbian operating system.

Installing and compiling Lazarus

Simple installation under Raspbian

In the Raspbian OS it is easy to install Lazarus and Free Pascal. In order to do this simply open a terminal window and type:

  sudo apt-get update
  sudo apt-get upgrade
  sudo apt-get install fpc
  sudo apt-get install lazarus

This installs a precompiled version of Lazarus on the Raspberry Pi. Of course, a network connection is required. Installation may take about 30 minutes, but major portions of this process take place automatically. After installation you may instantly start Lazarus from the "Programming" section of the LXDE start menu.

Compiling from sources

You may want to compile Lazarus from subversion sources. See Michell Computing: Lazarus on the Raspberry Pi for details.

Lazarus on Raspberry Pi
Lazarus on Raspberry Pi.

Accessing external hardware

One of the goals in the development of Raspberry Pi was to facilitate effortless access to external devices like sensors and actuators. One way to use this capability is Alex Schaller's wrapper unit for Gordon Henderson Arduino compatible wiringPi library.

wiringPi procedures and functions

Function wiringPiSetup:longint: Initializes wiringPi system using the wiringPi pin numbering scheme.

Procedure wiringPiGpioMode(mode:longint): Initializes wiringPi system with the Broadcom GPIO pin numbering shceme.

Procedure pullUpDnControl(pin:longint; pud:longint): controls the internal pull-up/down resistors on a GPIO pin.

Procedure pinMode(pin:longint; mode:longint): sets the mode of a pin to either INPUT, OUTPUT, or PWM_OUTPUT.

Procedure digitalWrite(pin:longint; value:longint): sets an output bit.

Procedure pwmWrite(pin:longint; value:longint): sets an output PWM value between 0 and 1024.

Function digitalRead(pin:longint):longint: reads the value of a given Pin, returning 1 or 0.

Procedure delay(howLong:dword): waits for at least howLong milliseconds

Procedure delayMicroseconds(howLong:dword): waits for at least howLong microseconds

Function millis:dword: returns the number of milliseconds since the program called one of the wiringPiSetup functions

External Links