#include <Servo.h>
Servo Sl;
int messwert;
int sensor(A0);
int Temperatur;
int knopf;
int trigger=7;
int echo=6;
long dauer;
long entfernung;
void setup() {
pinMode(12, INPUT);
pinMode(11, OUTPUT);
Sl.attach(9);
pinMode(6,INPUT_PULLUP);
}
{
pinMode(trigger, OUTPUT);
pinMode(echo, INPUT);
}
{
Serial.begin(9600)
knopf = digitalRead(6);
if (knopf == 0){
if (digitalRead 12==1) {
analogWrite(11, 450);
delay(500);
analogWrite(11, 10);
delay(500);
}
else {
analogWrite(11, LOW);
}
}
}
void loop() {
messwert=analogRead(sensor);
Temperatur=map(messwert,20,179,-40,62);
if(Temperatur>0<5){
Sl.write(22);
}
if(Temperatur>5<10){
Sl.write(45);
}
if(Temperatur>15<20){
Sl.write(90);
}
if (Temperatur>20<30){
Sl.write(125);
}
if(Temperatur>30<40){
Sl.write(150);
}
if(Temperatur=40){
Sl.write(180);
}
delay(86400000);
//digitalWrite(trigger, LOW)
//delay(5);
digitalWrite(trigger, HIGH);
delay(10); .
digitalWrite(trigger, LOW);
dauer = pulseIn(echo, HIGH);
entfernung = (dauer/2) * 0.03432;
if (entfernung >= 500 || entfernung <= 0)
{
Serial.println("Kein Messwert");
}
else
Serial.print(entfernung);
Serial.println(" cm");
}
delay(1000);
}
}