Last active
November 5, 2019 09:37
-
-
Save RobolinkAkademi/34639044e74fbef63540b92a30560251 to your computer and use it in GitHub Desktop.
Obstructing Example.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <dmoto.h> | |
dmoto obstacle; | |
void setup() | |
{ | |
Serial.begin(9600); | |
obstacle.pinSet(); | |
obstacle.Stop(); | |
} | |
void loop() { | |
Serial.println(obstacle.distance()); | |
if (obstacle.distance() < 15) | |
{ | |
obstacle.Backward(150); | |
delay(150); | |
obstacle.Right(0,150); | |
delay(250); | |
} | |
else | |
{ obstacle.Forward(150); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment