Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Pilot.setLinearSpeed(3);
- boolean LSense = false;
- boolean RSense = false;
- this.Pilot.forward();
- while(!LSense && !RSense) {
- LSense = LBlack();
- RSense = RBlack();
- }
- this.Pilot.stop();
- Pilot.setLinearSpeed(FORWARD_SPEED);
- if (LSense || RSense) {
- if (LSense) {
- gyroReset();
- double GyroReading = getGyroSample();
- while(GyroReading < 5 || GyroReading < -5) {
- while(!LSense) {
- this.tinyRotate(-1);
- GyroReading = getGyroSample();
- LSense = LBlack();
- };
- do {
- this.tinyRotate(-1);
- GyroReading = getGyroSample();
- RSense = RBlack();
- }while(!RSense);
- break;
- }
- }
- else if (RSense) {
- gyroReset();
- double GyroReading = getGyroSample();
- while(GyroReading < 5 || GyroReading < -5) {
- do {
- this.tinyRotate(1);
- GyroReading = getGyroSample();
- RSense = RBlack();
- }while(!RSense);
- do {
- this.tinyRotate(1);
- GyroReading = getGyroSample();
- LSense = LBlack();
- }while(!LSense);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement