Help with motion sensor code

Hey everyone, I'm pretty new to both the arduino and programming in a C style environment so I have a pretty basic question to ask.
I'm using the arduino along with a PIR motion sensor for an art installation in which the sensor will blink an LED as a warning. This works quite well but I would like the LED to start blinking faster the longer a person stands in front of the sensor. Is there a way I can create a loop that changes the longer the sensor is detecting motion? I'd also like to have the arduino activate the motor of a blender once the time limit has been exceeded, and am wondering how I might achieve this. My code is based on the motion_sensor_for_arduino sketch I found on the forums. I've added the sketch below as an atachment.

I'd really appreciate any help anyone can offer, thanks!

LED_on_off_fast.pde (1.39 KB)

motion_sensor_for_arduino.pde (1.6 KB)

these timer functions might be useful:

e. g. millis()
it is quite accurate and is good for time differences of about 49days (that should be enough for ur application...)...

u could remember an internal state:
state A: no motion since 40 seconds (or so)
state B: motion detected every 40 (or less) seconds since time stamp T0 (T0 is the time stamp of transition from state A to state B)...
the time stamp T0 will enable u to say since when the LED is blinking...
internal states can be implemented as global variables, that r declared outside of the loop() function... like this:

// global variables:
char state = 'A'; // or 'B'
uint32_t T0 = 0;
uint32_t Tlast = 0;

void setup() {
...
}

void loop() {
if no motion detected and state == 'A' then return;
if motion detected
then
if state == 'A' then T0 = millis();
state = 'B';
Tlast = millis();
else
if (millis()-Tlast > 40*1000) state = 'A';
do blinking according to millis()-T0
}

maybe u should make a further global variable for the blinking (a time stamp when the state of the LED changed last),
so that u dont miss a motion sensor message...