Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define odlegloscOdPrzeszkody 25
- #define kraniecRingu 6
- #define iloscObrotowDoPelnegoObrotu 27
- task main()
- {
- SetSensorColorFull(IN_2);
- SetSensorLowspeed(IN_4);
- unsigned int rawData[], normData[];
- int scaledData[];
- int cval;
- long t0, time;
- int rotations = 0;
- while (true) {
- if(SensorUS(IN_4)<odlegloscOdPrzeszkody && SensorUS(IN_4)>0){
- t0 = CurrentTick();
- while(true){
- ReadSensorColorEx(IN_2, cval, rawData, normData, scaledData);
- if (cval == kraniecRingu) {
- time = CurrentTick()-t0;
- OnFwd(OUT_AC, 75); Wait(time);
- Off(OUT_AC); Wait(100);
- t0 = CurrentTick();
- break;
- } else {
- OnRev(OUT_AC, 75); Wait(50);
- }
- }
- }
- else {
- if(rotations<iloscObrotowDoPelnegoObrotu){
- OnRev(OUT_A,60);
- OnFwd(OUT_C,60);Wait(150);
- Off(OUT_AC);Wait(100);
- rotations+=1;
- } else {
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement