Skip to content

example gpio

Brent Seidel edited this page Feb 23, 2017 · 1 revision

GPIO Example Program

Here is a simple example using GPIO on the Raspberry PI.

with BBS.embed;
with BBS.embed.RPI;
with BBS.embed.GPIO;
with BBS.embed.GPIO.Linux;

procedure main is
   tog_gpio : BBS.embed.GPIO.GPIO := BBS.embed.GPIO.Linux.gpio_new;
begin
   tog_gpio.configure(BBS.embed.RPI.GPIO_27, BBS.embed.GPIO.output);
   loop
      tog_gpio.set(1);
      tog_gpio.set(0);
   end loop;
end;

This program opens GPIO 27 for output and then toggles it as fast as it can forever. Not particularly useful on its own, but provides some idea of how things work.

Clone this wiki locally