Using Digital pins for IR 5 sensor array on Robotic car

Hello:

I am working with a group of students to utilize Osoyoo Robotic cars that are Arduino Uno-based. The code is being created using Arduino IDE either 1.8.18 or 2.3.0 on Mac desktop computers.

The students initially used a 5-array IR sensor from the same company through A0-A4 analog pins andthe 3.3V / ground pins for power, and we got basic Line Following working.

The next task is to program the vehicle to clear a defined area of Dixie cups, and we are running through some difficulties as we are trying to incorporate an MPU6050 gyrosensor into the vehicles and shift the IR sensor to digital pins D0-D4. That part is not going well; we are getting two issues:

  1. The students wired the IR sensor into the digitals, and find that the IR array has one sensor (either 2 or 4) that seems to be stuck in "detected" mode. The other IR sensors seem to work as previously. Still trying to use the same power pins, pinMode(d[0-4], INPUT); the sensor reading code was adjusted to read from the Digital pins. Observation suggests that input is not working, but not sure.
    2). Some students are finding that the same code that worked with the Analog pins now compiles with no errors, but when attempting to upload to the Arduino Uno, they are getting error exit -1, and the upload times out. This seems to be happening with both 1.8.18 and the 2.3.0 version of the Arduino IDE. The device does seem to be there.

The docs suggest this should be working, and compiling the code not giving errors, so we are trying to work out where the issues are occurring.

Appreciate guidance to get on the solution path.

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Using pins 0 and 1 is not a good idea because they are used by the Serial interface and to upload code to the Arduino, hence your problem

Thank you, I did not see that very pertinent fact.

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