//	ld-c103test0.c	gg630504 hg9ieg linux.ubuntu.gcc utf-8
//	2020-12-25 - 2020-12-26
// $ sudo usermod -a -G dialout $USER
// $ sudo apt-get update
// $ sudo apt-get install gcc
// $ sudo apt-get install make

#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <time.h>
#include <unistd.h>

int		main()
{
int		fdKey;
unsigned int	bwModem = TIOCM_RTS;
int		i;

fprintf( stdout, "gg630504.hg9ieg/ld-c103test0/" __DATE__ " " __TIME__ "\n" );
if( (fdKey = open( "/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY ))>=0 )
	{
	ioctl( fdKey, TIOCMBIC, &bwModem );	// szünet, space

	for( i = 0; i<3; i++ )
		{
		fprintf( stdout, "%d\n", i );
		ioctl( fdKey, TIOCMBIS, &bwModem );	// jel, mark
		usleep( 0.3*CLOCKS_PER_SEC );		// 0,3 másodperc
		ioctl( fdKey, TIOCMBIC, &bwModem );	// szünet, space
		usleep( 0.1*CLOCKS_PER_SEC );
		}

	close( fdKey );
	}
return( 0 );
}

