Servo controled by LDR

hi evrybody

i have servo motor controled over Ldr sensor

if the ldr become more than 70 the servo wil start from 0 to 90

i need to update it to be working with 2 types

i need it to be:
if the light source send signal one time the servo will go to from 0 to 90
and if the light source blink 3 times will send the servo from 0 to 180

please i need that help

thanks

my code

#include <Servo.h>

int potpin=0;// initialize analog pin 0, connected with photovaristor

int ledpin=13;// initialize digital pin 13, output regulating the brightness of LED

int greenLed= 12;

int val=0;// initialize variable val

Servo myServo;   // define servo name

 

/* The setup() function is called when a sketch starts. It is used to initialize variables, pin modes, start using libraries, etc. This function will only run once, after each power up or reset of the Arduino board. */

 

void setup()

{

pinMode(ledpin,OUTPUT);// set digital pin 13 as “output”
  
pinMode(greenLed, OUTPUT);

Serial.begin(9600);   // set baud rate at “9600”

myServo.attach(9);   // servo pin

myServo.write(0);     // servo start position

}

 

/* The loop() function executes the program repeatedly until Specified. */

 

void loop()

{

val=analogRead(potpin);// read the analog value of the sensor and assign it to val

Serial.println(val);// display the value of val

analogWrite(ledpin,val);// turn on the LED and set up brightness(maximum output value 255)
  
delay(10);// wait for 0.01

if(val>70)

{

   myServo.write(0); 


}
  
else

{

   myServo.write(90);

}

}

Your specification isn't very clear. What does "blink 3 times" mean in real life? Blink normally means go on then off.

But when it first goes on the servo goes to 90, then it goes off and the servo goes back to 0. That's one blink isn't it?

Or do you mean it has to blink 3 times within a certain time period, like maybe 2 seconds? In that case when the light first goes on you have to wait for at least 2 seconds to see if it's going to do 3 blinks so you need to move to 180 not 90.

And if it does move to 180 after 3 blinks when does it know to go back to 0?

Steve