3 * Very simple program to test the serial port. Expects
4 * the port to be looped back to itself
13 #include <wiringSerial.h>
19 unsigned int nextTime ;
21 if ((fd = serialOpen ("/dev/ttyAMA0", 115200)) < 0)
23 fprintf (stderr, "Unable to open serial device: %s\n", strerror (errno)) ;
27 if (wiringPiSetup () == -1)
29 fprintf (stdout, "Unable to start wiringPi: %s\n", strerror (errno)) ;
33 nextTime = millis () + 300 ;
35 for (count = 0 ; count < 256 ; )
37 if (millis () > nextTime)
39 printf ("\nOut: %3d: ", count) ;
41 serialPutchar (fd, count) ;
48 while (serialDataAvail (fd))
50 printf (" -> %3d", serialGetchar (fd)) ;