Inspired by all those Arduino / ESP8266 / etc. tutorials on controlling a LED from a web page... Requirements: - GNU Ada compiler (sudo apt-get install gnat) - Ada Web Server (sudo apt-get install libaws-bin libaws-doc libaws3.3.2-dev) - Munts Linux Simple I/O Library (see my post here about this, User Manual available here ) - LED (with a resistor) on GPIO17 I used as a starting point the "web-block" sample from AWS, changing a couple of things. For dealing with Raspberry Pi's GPIOs I made a simple package, using libsimpleio, of course ;) I also changed the directory structure, and added to the .gpr project all the libsimpleio related stuff. The entire project is on github here .
Ada provides an extensive set of capabilities for creating programs with concurrent code modules (tasks), for real-time programming, similar to Java threads. Those tasks are executed concurrently with the rest of the program, so I thought the best way to test them on a Raspberry Pi is by blinking two LEDs at different time intervals ;) Accessing the GPIO pins on a Raspberry Pi from an Ada program requires a library, I'm using Linux Simple I/O Library by Philip Munts. Assuming we have two LEDs (and corresponding resistors) on GPIO17 and 18, here's the source code for blinking them at different intervals, using tasks. -- -- GPIO LED Test using libsimpleio -- task version -- WITH Ada.Text_IO; USE Ada.Text_IO; WITH GPIO.libsimpleio; PROCEDURE blinky_tasks IS LED_red : GPIO.Pin := GPIO.libsimpleio.Create(0, 17, GPIO.Output); LED_green : GPIO.Pin := GPIO.libsimpleio.Create(0, 18, GPIO.Output); Ch : Character; Available : Boolean; task First_task; ...