changed flash time
#include <unistd.h>
#include <wiringPi.h>
+
+/*===========================================================================*/
+static void ledflash()
+{
+digitalWrite(0, HIGH);
+delay (20);
+digitalWrite(0, LOW);
+delay (200);
+digitalWrite(0, HIGH);
+delay (20);
+digitalWrite(0, LOW);
+delay (20);
+return;
+}
/*===========================================================================*/
int main()
{
int ret;
+int count;
if(wiringPiSetup() == -1)
{
puts("wiringPi failed!");
@@ -21,16 +36,10 @@ if(wiringPiSetup() == -1)
pinMode(0, OUTPUT);
pinMode(7, INPUT);
+count = 0;
+ledflash();
while(1)
{
- digitalWrite(0, HIGH);
- delay (250);
- digitalWrite(0, LOW);
- delay (250);
- digitalWrite(0, HIGH);
- delay (250);
- digitalWrite(0, LOW);
- delay (250);
if(digitalRead(7) == 1)
{
digitalWrite(0, HIGH);
@@ -41,9 +50,15 @@ while(1)
exit(EXIT_FAILURE);
}
}
- sleep(10);
+ sleep(1);
+ count++;
+ if(count < 5)
+ {
+ continue;
+ }
+ ledflash();
+ count = 0;
}
-
return EXIT_SUCCESS;
}
/*===========================================================================*/
