Browse Source

fixed timing order

subDesTagesMitExtraKaese 3 years ago
parent
commit
393a006f89
1 changed files with 3 additions and 3 deletions
  1. 3 3
      arduino/src/ultrasonic.cpp

+ 3 - 3
arduino/src/ultrasonic.cpp

@@ -35,18 +35,18 @@ void us_transmit() {
   //set pin 2, 3 and 4 to output
   DDRD  |= 0b00011100;
 
+  delayMicroseconds(2);
+
   //pull pin 2, 3 and 4 to 5V
   //doing this seems to lead to power supply issues and the serial interface stopps working
   //further testing needed!
   PORTD |= 0b00011100;
 
-  delayMicroseconds(2);
+  delayMicroseconds(5);
 
   //pull pin 2, 3 and 4 to GND
   PORTD &= 0b11100011;
 
-  delayMicroseconds(5);
-
   //set pin 2, 3 and 4 back to input
   DDRD  &= 0b11100011;