assuming you are working with an array of sensors , arranged in a straight line configuration like following
# # # # # # # #
The picture shows some situations that might arise when you cross the junctions. now you can program your micro-controller to increment junction count variable when any of these situations arises. ( remember that these situations may or may not occur in your case, you must check it)
in this example, increment junction count when you get
- all high ( or low depending on your hardware implementation) from the sensors.
- high (or low for inverse configuration) on sensors 1,2,5,6
- high (or low for inverse configuration) on sensors 2,3,7,8
here is a good link about line following , go through it if you still have some doubts.
http://www.ikalogic.com/tut_line_sens_algo.php