Your EasyEDA usage duration is brief. In order to avoid advertising information, this action is not supported at present. Please extend your EasyEDA usage duration and try again.
Editor Version×
Standard
1.Easy to use and quick to get started
2.The process supports design scales of 300 devices or 1000 pads
3.Supports simple circuit simulation
4.For students, teachers, creators
Profession
1.Brand new interactions and interfaces
2.Smooth support for design sizes of over 5,000 devices or 10,000 pads
3.More rigorous design constraints, more standardized processes
/*
Projeto: João Abadia v.2.0
Nesse projeto, pode-se controlar duas lâmpada (corredor e banheiro, por exemplo) com temporização.
Usa-se botões tipo campainha, sem retenção. Um clique acende a lâmpada e outro desliga.
Caso a lâmpada não seja desligada, o temporizador segue contando, dando uma "piscada",
avisando o final do tempo, desligando-as no tempo determinado nas linhas "unsigned long",
respectivamente "tempo corredor" e "tempo banheiro" (intervalo e intervalo11) utilizando a
fórmula "=====Configurações de tempo=====". Minha sugestão é 40 minutos para o banheiro e 10 minutos
para o corredor. Os tempos para "intervaloa3" e "intervalob3" devem ser de 30000, o que dará
um tempo de 30 segundos para o desligamento total das lâmpadas após essas piscarem.
"intervaloa2 e intervalob2" determinam o tempo que as lâmpadas piscam.
(led3) é usado para acionar um odorizador de ambiente enquanto que (led4) é ligado ao botão de acionamento manual do mesmo.
Esse projeto usa o arduino nano.
https://www.tinkercad.com/things/1WdxveF9ExR-luz-temporizada-2-lampadas-attiny/editel
https://easyeda.com/editor#id=2f48eb16f74e438297778abc398bbdb0
https://create.arduino.cc/editor/abadia50/9c8c7054-488b-4a24-9dbd-a4834cc00120
*/
#define led1 8 //led banheiro
#define led2 9 //led corredor
#define botao1 2 //botao corredor
#define botao2 3 //botao banheiro
#define led3 13 //saída para odorizador
#define led4 12 //disparo odorizador
int x1 = 0;
int x2 = 0;
int x3 = 0; //odorizador
unsigned long tempoa1; //tempo led1
unsigned long tempoa2; //tempo led2
unsigned long tempoa3; //tempo odorizador
/*
=====Configurações de tempo=====
1 minuto = 60000 ms (60000*minutos)
1 segundo = 1000 ms; 30 segundos = 30000 ms (1000*segundos)
*/
unsigned long intervaloa1 = 5000; // Tempo banheiro
unsigned long intervaloa2 = (intervaloa1 + 150);
unsigned long intervaloa3 = (intervaloa2 + 1500);
unsigned long intervalob1 = 5000; // Tempo corredor
unsigned long intervalob2 = (intervalob1 + 150);
unsigned long intervalob3 = (intervalob2 + 1500);
int tempoDelay = 500; //tempo de delay
void setup() {
pinMode(botao1, INPUT);
pinMode(botao2, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT); //odorizador
pinMode(led4, OUTPUT);
}
void loop() {
//========== lampada1 ==========
if (x1 == 1 and digitalRead(botao1) == 1) {
x1 = 0;
digitalWrite (led1, LOW);
delay(tempoDelay);
}
if (x1 == 1) {
if (millis() - tempoa1 > intervaloa1 and millis() - tempoa1 intervaloa2 and (millis() - tempoa1) intervaloa3) {
digitalWrite(led1, LOW);
x1 = 0;
}
}
if (x1 == 0 and digitalRead(botao1) == 1) {
x1 = 1;
digitalWrite(led1, HIGH);
tempoa1 = millis();
delay(tempoDelay);
}
//========== Lampada 2 ==========
if (x2 == 1 and digitalRead(botao2) == 1) {
x2 = 0;
digitalWrite (led2, LOW);
delay(tempoDelay);
}
if (x2 == 1) {
if (millis() - tempoa2 > intervalob1 and millis() - tempoa2 intervalob2 and millis() - tempoa2 intervalob3) {
digitalWrite(led2, LOW);
x2 = 0;
}
}
if (x2 == 0 and digitalRead(botao2) == 1) {
x2 = 1;
digitalWrite(led2, HIGH);
tempoa2 = millis();
delay(tempoDelay);
}
//========== odorizador ==========
if (x3 == 1) {
if (millis() - tempoa3 > 1500 and millis() - tempoa3
Forked project will be set private in personal workspace. Do you continue?
Clone
Project
The Pro editor is about to be opened to save as. Do you want to continue?
private message
Send message to abadia50
Delete
Comment
Are you sure to delete the comment?
Report
200114-Temporizador 2 lampadas nano
No Profile
Announcer: abadia50
Creation time: 2020-01-15 00:42:38
Published time:
2020-11-03 20:22:24
*
Report type:
Please select report type
*
Report reason:
Please fill in the reason for your report and the content is 2-1000
words
*
Upload image:
+
Upload image
*
Email address:
Please fill in your email address
Report
*
Report type:
Please select report type
*
Report reason:
Please fill in the reason for your report and the content is 2-1000
words
*
Upload image:
+
Upload image
*
Email address:
Please fill in your email address
Report
Submitted successfully! The review result can be viewed in the personal
center, review notification.
Kind tips
Your EasyEDA usage duration is brief. In order to avoid advertising information, this action is
not supported at present. Please extend your EasyEDA usage duration and try again.
Share
Project
Copy
Copy
Scan the QR code and open it on the mobile terminal