Skip to content

Commit

Permalink
#26 Backward Distance function
Browse files Browse the repository at this point in the history
  • Loading branch information
ganzourii authored Jul 3, 2018
1 parent 0140e27 commit 724dce9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Software/DistanceMeasuring/Backward Distance Function
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

void BackwardDistance (int a)
{
int PulsesNeeded = a*0.9794*2;
PulsesNeeded = floor(PulsesNeeded);
counter = 0;
while(counter < PulsesNeeded - 4 ){
Backward(120);
stateNew = digitalRead(Pin);
if (stateNew != stateOld){
stateOld = stateNew;
counter ++;
}
}
Forward(150);
delay(20);
Stop();
}

0 comments on commit 724dce9

Please sign in to comment.