Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(decyzja=='P' || decyzja=='p')
- {
- int i=10;
- NXT::Sensor::SetColor(&comm, IN_1, 'n');
- int color;
- int stare;
- int obecny;
- while(True)
- {
- color =NXT::Sensor::GetValue(&comm, IN_1);
- while(color<130)
- {
- NXT::Motor::SetForward(&comm, OUT_B, x);
- NXT::Motor::SetForward(&comm, OUT_C, x);
- color =NXT::Sensor::GetValue(&comm, IN_1);
- }
- stare=NXT::Sensor::GetSonarValue(&comm, IN_3);
- if(stare+i>179)
- stare=stare+i-179;
- else if(stare-i<0)
- stare=stare-i+179;
- obecny=NXT::Sensor::GetSonarValue(&comm, IN_3);
- while(stare+i!=obecny && color >=130)
- {
- NXT::Motor::SetReverse(&comm, OUT_C, y);//prawo
- NXT::Motor::SetForward(&comm, OUT_B, y);
- obecny=NXT::Sensor::GetSonarValue(&comm, IN_3);
- color =NXT::Sensor::GetValue(&comm, IN_1);
- }
- while(stare-i!=obecny && color >=130)
- {
- NXT::Motor::SetReverse(&comm, OUT_B, y);//prawo
- NXT::Motor::SetForward(&comm, OUT_C, y);
- obecny=NXT::Sensor::GetSonarValue(&comm, IN_3);
- color =NXT::Sensor::GetValue(&comm, IN_1);
- }
- i=i+5;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement