/*
 * The SOS blinking program
 */

#include <stdio.h>
#include <wiringPi.h>

// LED Pin - wiringPi pin 0 is BCM_GPIO 17.

#define	LED	0
#define LONG    500
#define SHORT   200

void pulse(int length) {
  /* send pulses */
    digitalWrite (LED, HIGH) ;	// On
    delay (length) ;		// mS
    digitalWrite (LED, LOW) ;	// Off
    delay (length) ;
}

int main (void)
{
  int i;
  printf ("Raspberry Pi send SOS\n") ;

  wiringPiSetup () ;
  pinMode (LED, OUTPUT) ;

  for (;;)
  {
    for (i=0;i<3;i++)
      pulse(LONG);
    for(i=0;i<3;i++)
      pulse(SHORT);
    for (i=0;i<3;i++)
      pulse(LONG);
    delay(1000);
  }
  return 0 ;
}
