What is the proper if statement to make the servo goes 180 and activates the red LED when the distance is less than 50 and goes zero and activates th

No, you appear to have shorted the supply to ground.

1 Like

1. All Vcc marked pins of the following Modules/Devices will be connected together.

DISTSRV
U1
SERVOSRV

2. But, where are the Vcc pins in U1 and SERVOSRV?

5V pin is the Vcc pin in U1.
PWR pin is the Vcc pin in SERVOSRV.

3. All GND marked pins of the following Modules/Devices will be connected together.

DISTSRV
U1
SERVOSRV
1 Like

Like this?

No! Not like that at all!!

Do the following:
1. Connect PWR-pin of SERVOSRV with 5V of U1.
2. Connect VCC-pin of DISTSRV with 5V of U1.
3. COnnect GND-pin of SEROSRV with GND-pin of U1.
4. Connect GND-pin of DISTSRV with GND-pin of U1.
5. Connect middle-point of R1-R2 with GND-pin of U1.

An Arduino can't power a servo, except perhaps a micro servo with no load. It needs its own power supply, the Arduino just controls it.

1 Like

And now?

Not yet correct.

Recheck with post #24.

Yes! It is SG-90 Servo with no-load.

1 Like

Tell us your background education so that we can plan accordingly to give you some hands on training on basic electronics!

Write down the names of few basic electronic components.

I don't use tinkercad,

I have a question about tinkercad for arduino
Do you connect the wiring in the schematic-view. Schematic-view is the one that you posted the pictures.

Or do you connect things in some kind of a bread-board-view?
The connections you made are obviously wrong. And the reason might be that you made the connections in the breadboard-view without understanding what inner connections the breadboard has.

best regards Stefan

Tinkercad is like Fritzing. All component are visualized and it is possible to look on schematic in another view and in this view it is not possible to change wiring.

you have seen this my picture

try to make schematic without breadboard at all


1 Like

Regarding Tinkercad, the schematic view changes accordingly to the changes that one makes in the virtual simulation of all the electronic components, meaning that the schematic view changes automatically. My uni work consists of using Arduino Uno, one breadboard, one micro servo, one ultrasonic sensor, two resistors of 330 kilo Ohms and two LEDs. I have seen amazing examples of water level sensors on Tinkercad containing all the components I mentioned previously, but lots of them do not work properly! Some of them do not have a functional micro servo which rotates with the test and some of them have wrong code. I don't know how to connect all the above components using the breadboard and LEDs on the virtual simulation!

When it comes to my knowledge of electronics concerning Arduino and Raspberry PI, as an example, I started studying the concepts circa six weeks ago, however I started the Tinkercad project some days ago.

This is the proper virtual simulation to which the schematic view that I posted belong.

The wiring in the HC-SR04 and servo is a bit confusing in your design!

clickable


1 Like

Now is it correct?

now VCC and GND

1 Like

Now is it a proper wiring?