U Turn maxiewawa May 17th, 2017 186 Never 186Never

Not a member of Pastebin yet? Sign Up , it unlocks many cool features!

rawdownloadcloneembedreportprint text 0.69 KB void loop() { // put your main code here, to run repeatedly int RightsensorValue = analogRead(A0); int LeftsensorValue = analogRead(A1); turnright(); //vehicle makes a right turn of approx 90 degrees delay(1000); stop(); delay(500); //commenting out this turn, then running the program with the robot resting on a black line does not trigger the while loop while(LeftsensorValue >900){ //while left sensor is white, turn right. If it's black, stop rotation. turnright(); delay(500); stop(); delay(500); int LeftsensorValue = analogRead(A1); Serial.print(LeftsensorValue);//even when Leftsensorvalue is less than 900 the while loop is going off. Serial.println(); } }

RAW Paste Data

void loop() { // put your main code here, to run repeatedly int RightsensorValue = analogRead(A0); int LeftsensorValue = analogRead(A1); turnright(); //vehicle makes a right turn of approx 90 degrees delay(1000); stop(); delay(500); //commenting out this turn, then running the program with the robot resting on a black line does not trigger the while loop while(LeftsensorValue >900){ //while left sensor is white, turn right. If it's black, stop rotation. turnright(); delay(500); stop(); delay(500); int LeftsensorValue = analogRead(A1); Serial.print(LeftsensorValue);//even when Leftsensorvalue is less than 900 the while loop is going off. Serial.println(); } }