One of my current academic work is to build up a water level sensor with Arduino Uno, a breadboard, an ultrasonic distance sensor, micro servo, 2 resistors and 2 red LEDs. I already wrote some code, but I need some guidance towards how to structure each section my code properly in order to make everything work altogether. The LEDs are meant to be turned on when the sensor detects that the water is reaching a risky level. Besides, I do need guidance towards the design that I made on Tinkercad. Does my design connect all the components that I have mentioned previously?
The purpose of the project is to prevent the overflowing of water of a government reservoir by detecting water level using the components that I have mentioned in my question.
All the components are meant to be connected, but I don't know how to connect them altogether properly in terms of structuring the code and the Arduino board.
I have just asked my tutor about the LEDs and he said that one LED should be green when the floodgate opens and the red is to alert the distance of the water. Both LEDS should work alongside with the micro servo.
I will change the colour of one of the LEDs into green.
Programmers on StackOverflow say that one should firstly look for answers in the forums of the things that one uses to make a project. I only utilise StackOverflow when my problem is not solved in the forum.