#include <Arduino.h>
#include <avr/io.h>
#include <math.h>
const int temperaturSensorPin = A0;
int temperatur = 0;
int readTemperatur=0;
void setup() {
DDRD |=(1<<0);
DDRD |=(1<<1);
DDRD |=(1<<2);
DDRD |=(1<<3);
DDRD |=(1<<4);
DDRD |=(1<<5);
DDRD |=(1<<6);
DDRD |=(1<<7);
DDRB |= (1<<0);
DDRB |= (1<<1);
DDRB |= (1<<2);
DDRB |= (1<<3);
DDRB |= (1<<4);
DDRB |= (1<<5);
DDRB |= (1<<6);
DDRB |= (1<<7);
ADMUX = 0;
ADMUX &= ~(1<<MUX0);
ADCSRA |=(1<<ADEN)|(1<<ADSC);
//PINB |=(1<<0);
}
int ce; //Counter EinerZiffern
int cz; //Counter Zehnerziffern
int ch; //Counter HunderterZiffern
int ct; //Counter TausenderZiffern
int main() {
setup();
_delay_ms(600);
double array[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
while (1){
int readTemperatur = analogRead(temperaturSensorPin);
int temperatur = readTemperatur / 100;
ADCSRA |= (1<<ADCH);
ce= temperatur;
PORTD = array[ce];
PORTB&=~(1<<0);
_delay_ms(10);
PORTB|=(1<<0);
ADCSRA |= (1<<ADCH);
cz= temperatur;
PORTD = array[cz];
PORTB&=~(1<<1);
_delay_ms(10);
PORTB|=(1<<1);
ADCSRA |= (1<<ADCH);
ch= temperatur;
PORTD = array[ch];
PORTB&=~(1<<2);
_delay_ms(10);
PORTB|=(1<<2);
ADCSRA |= (1<<ADCH);
ct= temperatur;
PORTD = array[ct];
PORTB&=~(1<<3);
_delay_ms(10);
PORTB|=(1<<3);
}}