Hello guys.
I’m developing an air conditioner for my Ford Maverick and I’m about to finish. But I have a little problem.
I need the compressor to stay on for at least 5 seconds (LOW STATE).
I say this because when the temperature oscillates 1 degree, it turns it on and off all the time.
I need it to stay on for at least 5 seconds after starting without using delay.
But I do not know how to use millis.
Please. I just need this to finish.
Thank you
============================================================
#include <Servo.h>
#include <Thermistor.h>
Servo servo_dir_vento;
Servo servo_agua_quente;
Thermistor temp(3);
int pot_vent = 0; // internal fan potentiometer
int pot_temp = 1; // temperature potentiometer
int pot_dir = 2; // air direction potentiometer
int ler_pot;
int ventilador = 0; // internal fan
int temp_selecionada = 0; // temperature selected
int direcao_vento = 0; // air direction servo
int posicao_servo_temp = 0; //temperature servo position
int compressor = 12; // AC compressor
int ventoinha_ar = 3; // AC fan
int velocidade_1 = 6; // internal fan speed 1
int velocidade_2 = 7; // internal fan speed 2
int velocidade_3 = 8; // internal fan speed 3
int velocidade_4 = 9; // internal fan speed 4
void setup()
void loop()
else
Serial.print(“POSICAO SERVO TEMP “);
Serial.println(posicao_servo_temp);
//===============================ventilation direction==============================
direcao_vento=map(analogRead(pot_dir),393,632,18,85); // para comutar o vento para o parabrisa ou para frente
servo_dir_vento.write(direcao_vento);
Serial.print(“POSICAO SERVO DIRECAO “);
Serial.println(direcao_vento);
//================================internal fan controler=============================
ventilador = analogRead(pot_vent); //Para ler os valores para as velocidade 1 a 4
//============================================speed 1==================
if (ventilador > 440 && ventilador < 470)
else
//============================================speed 2==================
if (ventilador >= 470 && ventilador < 500)
else
//============================================speed 3==================
if (ventilador >= 500 && ventilador < 530)
else
//============================================speed 4==================
if (ventilador >= 530 && ventilador < 580)
else
//====================================ac compressor and fan=========================
if (temp_selecionada <= temperature && ventilador > 440)
if (temp_selecionada > temperature && ventilador > 440)
if (temp_selecionada > 10 && temp_selecionada < 25 && ventilador > 440)
else
ler_pot = analogRead(pot_vent);
Serial.print(“POSICAO POTENCIOMETRO” );
Serial.println(ler_pot);
delay(1000);
}
Published at Sat, 03 Dec 2016 01:53:08 +0000