Me line follower array code


I have a Me line follower array and want to learn to use it on my Auriga
I am happy to start in Ardunio then once I figure it out I will make my own extension for it for my kids to use in Mblok5.

I open the sample program in Ardunio IDE and selected Mega2560 and correct port. I have the Me Line Follower Array plugged in to port 10 so I looked up the pin numbers for that port and they are A11 and A6 so I changed the DataPin from 2 to 11 then also tried 6. When I compile and upload it is successful and when I open a serial monitor it displays as expected but the reading is always 0 no matter whether it is over a black line or not. The blue lights on sensor do change depending upon line. What I am doing wrong??


I’ve never used this module, so caveat emptor, but have you tried adjusting the sensitivity pots?


I know the reading are changing because the lights change.

From what I can sort of tell from looking at the sample Ardunio code is it works something like a shift register and each of the lights/sensors will either be a 1 or a 0 and the pots are just to adjust how refective light is needed before they flick the schmitt trigger.

I think my problem is with the declaration of the DataPin not matching the connection to the sensor


Ah ok, sorry, when you said the lights do not change in your first post, I assumed it was a sensitivity issue.
Port 6-10 uses analog pins as you correctly stated. For port 10, their designation is A6 and A11.
Have you tried const int DataPin = A6; or const int DataPin = A11; ?


I did say in my original post that the lights do change.

Using “const int DataPin = A11;” fixed the problem. I am just not used to the abstratc way that Ardunio does things. I am used to using CPU naming of pins but Ardunio doesn’t instead it maps different names to them see

Thanks for your help :grinning:


Sorry- I Misread your original post! Glad you got it sorted though. I too find the Arduino way of working quite unusual - I spent decades developing industrial embedded software on a number of processor platforms, and Arduino still taking a bit of getting used to.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.