Errata
I was wondering about the fluctuations of the ultra sonic values. So I did a review of the programs. After a search for days I have found the error: The ultrasonic sensor was defective. But I found some other mistakes too. And here they are:
At the top of the main programs in the declaration You have to change:
* | 4 | Digit | PD4 | Line-M | In |
** | 4 | Digit | PD4 | Pushbutton | In - Alternative to Line-M for "Maze" |
* | 5 | OC0B | PD5 | PWM-B | Out |
* | 6 | OC0A | PD6 | PWM-A | Out |
* | 7 | PCINT23 | PD7 | Color-2 | In - DDRD = 0b01101000 |
** | 7 | Digit | PD7 | Pushbutton | In - Alternative to Color-1 for "Line" |
* | 8 | Digit | PB0 | Motor-B | Out |
* | 9 | Digit | PB1 | Motor-A | Out |
* | 10 | Digit | PB2 | Line-L | In |
* | 11 | PCINT3 | PB3 | Color-1 | In |
In correlation with it: The header Drive_Functions.h have to be changed.
And the part that´s so important to me, the time saving USART-Functions, didn´t save so much time I thought. There was an ugly little mistake. But now, I swear, it saves the time! To transmit a digit from the ATMega328P to your computer only 2 - 5 microseconds are needed.
The last correction, for the moment: At the header Init.h
TCCR0A = 0b10100011; //Fast PWM, Clear OC0x on compare match, set OC0x at BOTTOM
TCCR0B = 0b00000011;//00doesn´t matter,00unimpl.,0PWM,011TMR0-Pres1:64
The PWM was to fast and the wave form doesn´t fit.
And, of course, there are no UV (Ultra Violet) sensors, but only IR (Infra Red).