Howdy! I am relatively new to the world of Arduino, so don't be frustrated if I ask questions that could be silly. This project has a deadline, so any input is appreciated.
THE PROJECT:
I am planning to build a 2WD vehicle, with an arm using 2 servos, and a TCS3200 color sensor. The goal is to make the robot avoid obstacles while simultaneously searching for a GREEN colored object (using the color sensor). After finding the GREEN object, it would stop and use the robotic claw to grab the object. Finally, it would continue to avoid obstacles until you reach a RED colored area. It would drop the object and start again.
Something like this: Area cleaning color sensor robot - YouTube
QUESTIONS:
That said, I have some questions about the use of different sensors to control a robot (do not hesitate to put any input that may be useful):
-
How would you connect it to the sensor shield considering the other components? Could you use analog pins or (converting digital to analog) or use fewer pins? (I just need Green and Red)
-
How would make it so that the Arduino receives data from both sensors at the same time? How can I make both sensors control the same two motors?
WIRING: wiring exactly the same bigger image
NOTE: in the second image the ultrasonic sensor should be connected to the bottom right pins
You say you are subject to a deadline. If it was me doing this project (at any level of experience), the first thing I would do is use Google to find technical documentation to answer questions like, "Does a TCS3200 color sensor need PWM pins to work?".
It's actually faster than asking in a forum. I think you might be looking too much at people's projects and opinions, instead of base documentation for example TCS3200 data sheet, libraries and so on...
You have not given a link to your ultrasonic sensor. If you have a data sheet or look at example programs, you will see it is blocking your program until it either receives an echo or times-out waiting for one. So, can't even consider using it at the same(relative) time as another sensor.
Paul
Then how is this guy able to do it?
alex654:
Then how is this guy able to do it?
Maybe s/he's smart, and spent time learning about the problem
The first thing to do is get an Uno or similar, a color sensor and an ultrasonic ranger.
Then, separately, study one or more of the many example tutorials for each, and get each working individually.
Once that is done, you will be in fine shape to start thinking about using them together on a robot.
aarg:
By not using pulseIn().
What could I use as an alternative then or how can I do it the proper way? Thanks for all the input so far!