#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

#define BAUDRATE 9600
#define PORT "/dev/ttyS0"

int main() {
	// set up serial PORT
	fd_serial = open(PORT, O_RDWR | O_NOCTTY ); 
	tcgetattr(fd_serial, &oldtty); // save current PORT settings
	bzero(&tty, sizeof(tty));
	tty.c_iflag = 0; tty.c_lflag = 0; tty.c_oflag = 0; tty.c_cc[VTIME] = 0; tty.c_cc[VMIN] = 1;
	tty.c_cflag = BAUDRATE | CS8 | CLOCAL;
	tcflush(fd_serial, TCIFLUSH);
	tcsetattr(fd_serial, TCSANOW, &tty);

	write(fd_serial, "t", 1);
}
