comp.lang.ada
 help / color / mirror / Atom feed
From: elbric0 <jasmin.stlaurent@gmail.com>
Subject: How to use GNAT.Serial_Communications ?
Date: Fri, 13 Sep 2013 18:39:27 -0700 (PDT)
Date: 2013-09-13T18:39:27-07:00	[thread overview]
Message-ID: <05ecdd0e-41cf-4961-88db-22e0a8cba3f6@googlegroups.com> (raw)

Hi,

I am learning Ada and try to figure how to communicate with an electronic device on a serial port.

I think the code to print 'A' to COM1 on Windows should be about that.

----------------------------------------------------------------
with GNAT.Serial_Communications; use GNAT.Serial_Communications;

procedure Test_Serial is

   Serial : Serial_Port;
   C : Character;

begin

   Open (Port => Serial, Name => Name (1));

   C := 'A';

   Character'Write (Serial, C);

   Close (Serial);

end Test_Serial;
----------------------------------------------------------------

However the type of the first parameter of Character'Write is not correct. I get this error message: "expected access to Ada.Streams.Root_Stream_Type'Class".

Can someone tell me what I should put there instead of Serial?

Do you know any tutorial or code example that can help me?

             reply	other threads:[~2013-09-14  1:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-14  1:39 elbric0 [this message]
2013-09-14  5:42 ` How to use GNAT.Serial_Communications ? Simon Wright
2013-09-14 12:10   ` jasmin.stlaurent
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox