Proximity Sensor SR04 and Mega 2560 - Programming

Thread Starter


Joined Oct 15, 2019

Sorry to be asking this question as I am very new in Arduino and the programming side.

I have been search online about SR04 and Mega 2560 because we are trying to test the proximity sensor and how we can apply it on our project.

I followed the connection I saw online, but the problem is when I do the program/code in arduino. I actually happened to make it work once but after that it is not giving values anymore when I am trying the sensor.. Also, found that the RX LED in Mega is not blinking only the TX.

Not sure where to start and how.


Joined Jan 29, 2010
Hi MD,
Welcome to AAC.
If the Mega is 'suspect' I suggest you try the simple Blink code in the Arduino examples, let us know the result.

Do you have the SR04 wired as per this digram.?