Are resistors optional?

Hi all, first post here so go easy on me. I come from a coding background and have very little knowledge of circuits so forgive the basic questions. I’m on a journey here :smile:

So, I don’t understand why this setup doesn’t need resistors:
https://www.circuito.io/app?components=512,11021,13959

where as this setup does:
https://www.circuito.io/app?components=513,13959,360217

I’ve bought an ESP32 controller and want to connect an ultrasonic sensors to it. Do I need the resistors, if so, could someone explain why I need them.

As I said, I’m at the beginning of my circuitry journey here :smile:

Thank you.

Hi

I’m also on that journey and from a coding background.

As I understand it, the resistors are used to restrict current. I suspect the Arduino is capable of providing enough power (current) but the ESP32 isn’t. It looked to me like that was the only difference in your circuits.

Hope that helps