# Re: Help me !!!

sir I have done some main part of coding for traffic density identification and control based on ir sensor
the main idea is
switch(var)
{
case1://north
if(level1 ir>level2 ir);run(30 sec)
if(level2 ir>level3 ir);run(60 sec);
if(level3 ir >);run(90 sec);
break;
case2://south
if(level1 ir>level2 ir);run(30 sec)
if(level2 ir>level3 ir);run(60 sec);
if(level3 ir >);run(90 sec);
break;
case3://east
if(level1 ir>level2 ir);run(30 sec)
if(level2 ir>level3 ir);run(60 sec);
if(level3 ir >);run(90 sec);
break;
case4://west
if(level1 ir>level2 ir);run(30 sec)
if(level2 ir>level3 ir);run(60 sec);
if(level3 ir >);run(90 sec);
break;
default:
reset to red
break;
}
my doubt is how to compare all the four lanes by using if loop inorder to provide a one side traffic flow .will switch case can be used inside the if loops.

the main idea is

That's not an idea, it's code. What's it supposed to do? Only the 3rd last line gives us a clue: the word "red" makes me think it has something to do with traffic lights?

Don't be so silly @JimboZA - the clue is in the title.

...R

Robin2:
Don't be so silly @JimboZA - the clue is in the title.

...R

How could I have missed that?