Skip to content

Instantly share code, notes, and snippets.

@RobolinkAkademi
Created October 3, 2019 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobolinkAkademi/d306124f6f3b4c7e4d9d40d907ab1af8 to your computer and use it in GitHub Desktop.
Save RobolinkAkademi/d306124f6f3b4c7e4d9d40d907ab1af8 to your computer and use it in GitHub Desktop.
LightTracer Example.ino
#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