CURRENT ISSUE Contests
Feature Article
|
|
Issue #212 March 2008
Robotics with Ada95
by Daniel Ramirez
Start | Why Use Ada95 For Robotics? | GNAT Ada95 Tools | Debugging Ada95 Applications | Ada95 Coding Style |Wireless Sensor Controller | Wireless Messages | The Glove In Action | XYZ Accelerometers | XBee-PRO Wireless UART | Controller Range | USB 2.0 Interface | Ethernet | The Kernel | Ada95 vs. Other Languages | Future Applications | Sources & PDF
LISTING 1
Listing 1—Here is an example of communication between your Ada95 application and a remote robot at 115,200 bps, 8 data bits, and 1 stop bit. I used the serial port to access wireless telemetry (joystick positions) from a wireless sensor controller using the XBee-PRO wireless UART.
--*******************************************************************
--* Initialize_Joystick - Initialize XBEE Pro boards running the
--* Joystick firmware that are connected to the PC or laptop
--*******************************************************************
procedure Initialize_Joystick (Com_Port : IN OUT Com_Ports.Handle_Type; Name : IN STRING;
Baud_Rate: Interfaces.C.Unsigned_Long ) IS
Joystick_ID : integer := 1;
begin -- Initialize_Joystick
-- Open the serial ports for SARD/EVB wireless UART at 115200, N, 8, 1...
Com_Ports.Open (Com_Port, Name, Baud_Rate, 'N', 8, 1);
exception
when E : others =>
ADA.TEXT_IO.Put_Line(Ada.Exceptions.Exception_Name (E) & "---" &
Ada.Exceptions.Exception_Message(E));
ada.text_io.Put_Line ("Initialize_Joystick: exception 'others' ");
end Initialize_Joystick;