Something of a People Counter


ok, photocell , laser set in arduino. when photocell recieving signal, red led lights signify laser on. set range of values detectable photocell. purpose of count number of times photocell has been tripped. more stuff added circuit later, im having trouble making other led light want to. have created counter each time red led turns off counter becomes +1, trouble having put code other led show how many times system has been tripped. want photocell , laser still looking breaks able continuously count times has been broken. im new arduino , wasnt sure if chip can work in way.

so basically, when photocell tripped counter begins , increases, each time tripped yellow led blink each time , continue trips , count trips when yellow blinking.

int photocellpin = 0;// photocell connected analog pin 0
int photocellval = 0; // define photocell variable
int led1=3;
int led2=5;
int counter=0;

void setup()
{
serial.begin(9600);
pinmode(photocellpin, input);
pinmode(led1,output);
pinmode(led2,output);
photocellval = analogread(photocellpin);// read analog photocell

}


void loop()
{
int current_value;
current_value=analogread(photocellpin);
serial.println(current_value);    // print screen
delay(30);



if (current_value<600)
{
   digitalwrite(led1,low);
   counter=counter+1;
}
   else
   {
     digitalwrite(led1,high);

   }

//this im not sure of put//
//i want 5 second delay between series of blinks counting trips , 1 second between each blink
//ie --- wait 5 sec ---
for(int x=0; x<5000;x++)
{
for(int = 0; < counter; i++)
{
   digitalwrite(led2, high);
   delay(500);
   digitalwrite(led2, low);
   delay(500);
}
}

}

any appreciated

quote
//this im not sure of put//

i'd suggest put somewhere far, far away.

look @ blink without delay example see how toggle led without using delay() function. using delay() block counter 5000 seconds times current count value.


Arduino Forum > Using Arduino > Programming Questions > Something of a People Counter


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial