For a final project, I (in a team of three) have been tasked with making a robot to complete a few tasks. The tasks are to locate colored blocks, identify the colors, and move them to an elevated goal within a small oval arena marked by a black line. Over the semester we were given labs to explore different components and sensors in collaboration with Arduino programming, however I am asking for guidance on how this code can be structured in order to operate effectively.
We know the basic components that will make up the robot:
A two-motor base with castor wheel (We already have it moving with functions for different movements)
An infrared sensor to detect if the robot goes beyond the enclosed area
Multiple ultrasonic sensors to detect distances to the blocks and the goal
A "color sensor" which is an RGB LED next to a photocell. This will be a challenge, our professor showed us it working with lots of code techniques that he hasn't really taught us. But essentially each color flashes on an object and the photocell readings are then compared to stored 'calibrated' values for different colors.
Our professor also designed and constructed shields for our Arduinos; they have a motor controller for the two drive motors, as well as organized pins for the various sensors that are needed.
The mechanical side of this project (picking up and delivering the blocks) should be fairly easy, using a servo and/or stepper motor and 3D printed components.
However its the general code structure of this assignment that i'm trying to understand. Our professor never fully taught us how we can structure multiple functions and operations into one 'algorithm' for such a complex system. We will need to constantly be reading sensor values and I am lost on how all of this will fit together smoothly.
***So I only saw the "SeveralThingsAtTheSameTime.ino" thread after I posted this. I apologize for being repetitive. Can my code work on in a similar way to that code structure? Sensor values must be read and then certain actions will have to be executed, are there any specific methods for what I am trying to do?