Subversion Repositories svnkaklik

Rev

Rev 235 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 235 Rev 236
Line 56... Line 56...
56
         SetServo(CASAVR-CASMIN);
56
         SetServo(CASAVR-CASMIN);
57
         SaveLog(log-1);      // Zapis Black Boxu do EEPROM
57
         SaveLog(log-1);      // Zapis Black Boxu do EEPROM
58
         goto cihla; // Znovu zacni cihlu objizdet
58
         goto cihla; // Znovu zacni cihlu objizdet
59
         // Pozor! Pamatuje se, jestli jsme uz neprejeli caru!
59
         // Pozor! Pamatuje se, jestli jsme uz neprejeli caru!
60
      };
60
      };
61
      
61
 
62
      if(IRRX) // hrozi celni srazka s cihlou v prubehu objizdeni
62
      if(IRRX) // hrozi celni srazka s cihlou v prubehu objizdeni
63
      {
63
      {
64
         cas=CASMIN;
64
         cas=CASMIN;
65
      }
65
      }
66
      else
66
      else
Line 86... Line 86...
86
      set_pwm2_duty(r2);
86
      set_pwm2_duty(r2);
87
 
87
 
88
      SetServoQ(cas);
88
      SetServoQ(cas);
89
 
89
 
90
      i2c_start();     // Sonar Ping
90
      i2c_start();     // Sonar Ping
91
      i2c_write(0xE0);
91
      i2c_write(SONAR_ADR);
92
      i2c_write(0x0);
92
      i2c_write(0x0);
93
      i2c_write(0x52);  // mereni v us
93
      i2c_write(0x52);  // mereni v us
94
      i2c_stop();
94
      i2c_stop();
95
 
95
 
96
      for(n=1;n<=90;n++) // 18ms testovani cary do dalsi korekce serva
96
      for(n=1;n<=90;n++) // 18ms testovani cary do dalsi korekce serva
Line 102... Line 102...
102
         delay_us(100);
102
         delay_us(100);
103
         if(read_adc()<THR) touch|=R_TOUCH;
103
         if(read_adc()<THR) touch|=R_TOUCH;
104
      };
104
      };
105
 
105
 
106
      i2c_start();     // Odraz ze sonaru
106
      i2c_start();     // Odraz ze sonaru
107
      i2c_write(0xE0);
107
      i2c_write(SONAR_ADR);
108
      i2c_write(0x3);
108
      i2c_write(0x3);
109
      i2c_stop();
109
      i2c_stop();
110
      i2c_start();
110
      i2c_start();
111
      i2c_write(0xE1);
111
      i2c_write(SONAR_ADR+1);
112
      vzdalenost=i2c_read(0);
112
      vzdalenost=i2c_read(0);
113
      i2c_stop();
113
      i2c_stop();
114
 
114
 
115
      if(touch==L_TOUCH) disp(0xC0);
115
      if(touch==L_TOUCH) disp(0xC0);
116
      if(touch==R_TOUCH) disp(0x03);
116
      if(touch==R_TOUCH) disp(0x03);