REPALphilread / ReP_AL-3D-Lawn-Mower

Code and Other for the ReP_AL Lawn Mower
104 stars 53 forks source link

Sonar.INO: unsafe sequence #25

Open MomoRC-tech opened 4 years ago

MomoRC-tech commented 4 years ago

SONAR.INO in actual Master Branch:
//Sets the trigPin at High state for 10 micro secs sending a sound wave digitalWrite(trigPinX, HIGH); digitalWrite(trigPinX, LOW); delayMicroseconds(10);

-->safer/more stable sequence (in consens with manufactures rerefence design):

digitalWrite(trigPinX, LOW); // prepare "clean" transition to HIGH delayMicroseconds(2);
digitalWrite(trigPinX, HIGH); delayMicroseconds(10); // set HIGH for >= 10ms digitalWrite(trigPinX, LOW);