I am currently learning Arduino and I just need help with the sketch I made for a program that uses ultra sonic sensor(HC-SR04) that has 2 LEDs where 1st LED lights if the object is atleast 2 cm away and 2nd LED lights if the object is 2cm beyond
the problem is that the monitor always reads 0 distance and both LEDs light up.
Are you wanting to pay someone to help you with this problem? The reason I ask is because that's what this forum section is for.
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar, then you can manually add the code tags: [code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.
Please always do an Auto Format (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor) on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.
I do not understand how the code you have shown could have generated the output you have linked appears to show time in HH:MM:SS format with milli seconds added and also, and every alternate Distance is something other than the zero which you claim in your posts.