Skip to main content
11 events
when toggle format what by license comment
Jun 11, 2022 at 5:35 comment added aaa @ItrysohardbutIcryharder Yes, you can look at what it functionally does and implement the same in Python. But searching for "HC-SR04 raspberry pi" will also do the trick. For example: tutorials-raspberrypi.com/…
May 18, 2022 at 7:35 comment added I try so hard but I cry harder @Paul Is there anyway I could translate this piece of code to Python?
Jan 22, 2016 at 16:46 comment added HDatta Thnx...I get it now.
Jan 22, 2016 at 8:22 comment added aaa @Reptile, the max ranging of the sensor (according to datasheet is 400cm. The time a pulse takes to Travel 400cm is 400*58, so yes, it's a time out in time. But I linked it to the distance, so it's easier configurable. You can set it to defect items at a distance lower than 50cm, or 100cm, really anything below the max. If it won't find an object, it'll just time out, which can be really usefull.
Jan 20, 2016 at 14:44 vote accept HDatta
Jan 20, 2016 at 14:26 comment added HDatta so what is meant by the 400cm there... I thought that timeout will have a specific amount of time.
Jan 20, 2016 at 14:24 comment added aaa Not much really, it's more readable and easier to change I guess.
Jan 20, 2016 at 14:21 comment added HDatta What is the use of making the variable?
Jan 20, 2016 at 14:08 comment added aaa @Reptile1234 in my example, I added the line const unsigned long timeout = 400*58; //Max of 400CM, adjust this to your own max. effectively storing the value of 400*58 in the variabel named timeout, and used this as an argument to the PulseIn function. You could also just put the value in the arguments of that function. The delayMicroseconds is to put the trigger pin high (wait 10uS) and then low, so the ranging will start.
Jan 20, 2016 at 14:03 comment added HDatta This is my first time working with arduino so I was having trouble grasping the format of the PulseIn function. Do we need to put some time in place of time-out or does it use the delayMicroseconds(10) value...
Jan 20, 2016 at 11:50 history answered aaa CC BY-SA 3.0