Maker Pro
Maker Pro

controlling hc-sr04 more than one at the same time

hello guys, i have a project related with ultrasonic sensor, i have no problem when i control just one sensor. but when i start to control more than one hcsr04 sensors it doesn't work simultaneously . what i want to do is the all of the sensors generate the ultrasonic wave and receive the echo at the same time. when i put something in front of #UltrasonicSensor 1 so the buzzer1 will ring, when i put something in front of #UltrasonicSensor2 then buzzer2 will ring and if i put something in front of them all buzzer will ring together. if you guys dont mind please check the pic of my code , if you find any mistakes or have any idea to help me ,it we'll be really good and i appreciate a lot. thanks guys, if you still dont understand what i mean just comment or PM me thanks a lot
 

Attachments

  • 1.PNG
    1.PNG
    10 KB · Views: 93
  • 2.PNG
    2.PNG
    10.6 KB · Views: 112
  • 3.PNG
    3.PNG
    11.3 KB · Views: 83
  • 4.PNG
    4.PNG
    12 KB · Views: 73
Please explain what your code is suppose to do. And what in particular is not working?
Adam
what i want to do is make the two sensors work simultaneously, when the first sensor generate the ultrasonic wave the second generate ultrasonic wave too. with current code, it works alternately. and i want when there is an object in front of sensor1, then buzzer1 will ring, if the object in front of sensor2 then buzzer 2 will ring, and i the object is in the middle of both sensors, then both buzzer will ring. my code still cant control like that , that's the problem. thanks for your comment i appreciate it alot
 
Top