Created
October 3, 2019 09:11
-
-
Save RobolinkAkademi/d306124f6f3b4c7e4d9d40d907ab1af8 to your computer and use it in GitHub Desktop.
LightTracer 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 Light; | |
float ldrRemove =0; | |
void setup() { | |
Serial.begin(9600); | |
Light.pinSet(); | |
Light.Stop(); | |
} | |
void loop() { | |
ldrRemove = abs(Light.LdrRightValue() - Light.LdrLeftValue()); | |
Serial.print(Light.LdrRightValue()); | |
Serial.print(" "); | |
Serial.print(Light.LdrLeftValue()); | |
Serial.print(" "); | |
Serial.println(ldrRemove); | |
delay(30); | |
if (Light.LdrRightValue() > Light.LdrLeftValue() && ldrRemove > 80) | |
{ | |
Light.Left(150,70); | |
} | |
if (Light.LdrRightValue() < Light.LdrLeftValue() && ldrRemove > 80) | |
{ | |
Light.Right(70,150); | |
} | |
if (ldrRemove < 80) | |
{ | |
Light.Forward(150); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment