Last active
March 5, 2020 08:12
-
-
Save samilkorkmaz/d22abfb7ada982f10e21bad18d08ab09 to your computer and use it in GitHub Desktop.
Robolink Rodeo line tracking sensor test
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
//Robolink Rodeo line tracking sensor test. https://www.youtube.com/watch?v=er_i-MaEoKU | |
//Rodeo robot purchase link: https://www.robolinkmarket.com/arama?q=rodeo | |
const int lineSensorLeft = A0; | |
const int lineSensorMiddle = A1; | |
const int lineSensorRight = A2; | |
void setup() { | |
Serial.begin(9600); | |
} | |
bool isWhite(int val) { | |
return val < 200; | |
} | |
void printVal(char* str, int val) { | |
Serial.print(str); | |
Serial.print(" = "); | |
Serial.print(val); | |
Serial.print(", "); | |
isWhite(val) ? Serial.print("white. ") : Serial.print("black. "); | |
} | |
void loop() { | |
int sensorLeftVal = analogRead(lineSensorLeft); | |
printVal("sensorLeftVal", sensorLeftVal); | |
int sensorMiddleVal = analogRead(lineSensorMiddle); | |
printVal("sensorMiddleVal", sensorMiddleVal); | |
int sensorRightVal = analogRead(lineSensorRight); | |
printVal("sensorRightVal", sensorRightVal); | |
Serial.println(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment