Това успях да сътворя int motor1A = 1;
int motor1B = 2;
int motor1C = 3;
byte sekund=0;
byte minutes=0;
byte hour=0;
byte hour2=0;
byte day=0;
byte rootingDerection=0;
int sensePinT=0;
int lampPin=4;
int fanPin=7;
int errorLedPin=8;
void setup() {
pinMode(motor1A, OUTPUT);
pinMode(motor1B, OUTPUT);
pinMode(motor1C, OUTPUT);
pinMode(lampPin, OUTPUT);
pinMode(fanPin, OUTPUT);
pinMode(errorLedPin,OUTPUT);
}
void loop() {
if (day==21&&hour==12){
// тук трабва да се презапишат всички промнливи на 0.
}
if (sekund>59) {
sekund=0;
minutes=minutes+1;}
if(minutes>59){
minutes=0;
hour=hour+1;}
if(hour>24){hour=0;
day=day+1;
if (rootingDerection==0){
analogWrite(motor1C, 120);
digitalWrite(motor1A, HIGH);
digitalWrite(motor1B, LOW);
delay(200);
analogWrite(motor1C, 0);
digitalWrite(motor1A, LOW);
digitalWrite(motor1B, LOW);
delay(200);
rootingDerection=1;
}
else if (rootingDerection==1){
analogWrite(motor1C, 120);
digitalWrite(motor1A, HIGH);
digitalWrite(motor1B, LOW);
delay(200);
analogWrite(motor1C, 0);
digitalWrite(motor1A, LOW);
digitalWrite(motor1B, LOW);
delay(200);
rootingDerection==0;
}
else{digitalWrite(errorLedPin,HIGH);}
hour2=hour2+hour;
sekund=sekund+2;
}
if (hour>hour2){
if (rootingDerection==0){
analogWrite(motor1C, 120);
digitalWrite(motor1A, HIGH);
digitalWrite(motor1B, LOW);
delay(200);
analogWrite(motor1C, 0);
digitalWrite(motor1A, LOW);
digitalWrite(motor1B, LOW);
delay(200);
rootingDerection=1;
}
else if (rootingDerection==1){
analogWrite(motor1C, 120);
digitalWrite(motor1A, HIGH);
digitalWrite(motor1B, LOW);
delay(200);
analogWrite(motor1C, 0);
digitalWrite(motor1A, LOW);
digitalWrite(motor1B, LOW);
delay(200);
rootingDerection==0;
}
else{digitalWrite(errorLedPin,HIGH);}
hour2=hour2+hour;
sekund=sekund+2;
}
else{digitalWrite(errorLedPin,HIGH);}
int val=analogRead(sensePinT);
if (val<530) {
digitalWrite(lampPin,HIGH);
digitalWrite(fanPin,LOW);}
else if (val>650){
digitalWrite(lampPin,LOW);
digitalWrite(fanPin,HIGH);}
else{digitalWrite(errorLedPin,HIGH);}
delay(200);
sekund+1;
// И предполагам че тук трабва да се презапишат всички изпозвани променливи в EEPROM.
}
Сега си спомням че някъде четох за една функция която давала точно преди колко време е била включено ардуино платката, не знам да ли няма да ми свърши работа.