My project idea is to count the cars numbers on each road using infrared detection sensor and open the green traffic light for a specific time generated using an equation that includes car numbers in both sides but i am still beginner in arduino and i need help ASAP to write this code.
thanks
nahas:
My project idea is to count the cars numbers on each road using infrared detection sensor and open the green traffic light for a specific time generated using an equation that includes car numbers in both sides but i am still beginner in arduino and i need help ASAP to write this code.
thanks
Welcome to the Arduino forum.
What experience do you have with infrared detection, traffic light control and an actual Arduino?
Long before you write any code, you must identify, in detail, what you have to work with. Specifically identify the IR detector you have chosen, Identify how you are going to control the traffic light so it will turn on the green light.
Once identified, then use sample programs to learn about only those pieces identified. write small programs to exercise those components. Only then can you begin to think about how to put that all together into a program for your proposed project.
Paul
Paul_KD7HB:
Welcome to the Arduino forum.What experience do you have with infrared detection, traffic light control and an actual Arduino?
Long before you write any code, you must identify, in detail, what you have to work with. Specifically identify the IR detector you have chosen, Identify how you are going to control the traffic light so it will turn on the green light.
Once identified, then use sample programs to learn about only those pieces identified. write small programs to exercise those components. Only then can you begin to think about how to put that all together into a program for your proposed project.
Paul
i already did my research about infrared detection sensor and how to code it but so far all i keep finding is how to code an infrared sensor to count cars and show it on LCD and that is not what i want i want it after counting to put the numbers counted in an equation to give the traffic lights the time they need to open and i lack the experience to do such code.
is how to code an infrared sensor to count cars and show it on LCD and that is not what i want i want it after counting to put the numbers counted in an equation
To display to an LCD, you normally would use a function.
To calculate an equation, you could also use a function.
Using functions would appear to be key to your learning.
nahas:
i already did my research about infrared detection sensor and how to code it but so far all i keep finding is how to code an infrared sensor to count cars and show it on LCD and that is not what i want i want it after counting to put the numbers counted in an equation to give the traffic lights the time they need to open and i lack the experience to do such code.
So, leave out the part about displaying on LCD. Then you have the opportunity to put in the parts you want.
And what did you find about having the Arduino talk to the traffic lights?
Paul
Paul_KD7HB:
So, leave out the part about displaying on LCD. Then you have the opportunity to put in the parts you want.And what did you find about having the Arduino talk to the traffic lights?
Paul
i looked in to traffic light systems made with arduino and the key seemed to be that they use fixed times in the delay between every command and that delay would be the time given to the lights to stay green, red or yellow but in my project i need to make this time variable depending on cars number put in my equation. so the systems i saw didn't help either
seemed to be that they use fixed times in the delay between every command
Perhaps rather than a fixed, or constant, time, you could make the delay variable.
AWOL:
To display to an LCD, you normally would use a function.
To calculate an equation, you could also use a function.Using functions would appear to be key to your learning.
Yes, i already know about that but my problem here is that i can't make my own function for this idea
nahas:
Yes, i already know about that but my problem here is that i can't make my own function for this idea
How do you know you can't? Show us the logic, not the code, to do what you want.
Paul
Paul_KD7HB:
How do you know you can't? Show us the logic, not the code, to do what you want.Paul
The logic is that i want an infrared sensor fixed on each road of the 2 roads i am working on, these sensors should count cars passing in front of them the cars counted should be put in that equation
You wrote that you had code to count cars.
Start with that.