
Me toma como que bot3 siempre está en 1.
Publicado por Santiago (1 intervención) el 26/03/2021 16:42:04
Estoy tratando de hacer un sistema para un estacionamiento, no es que lo valla a usar con ese fin, pero lo quería hacer como pasatiempo. el problema es que por mas que yo no apriete el botón 3, el tiempo sigue subiendo, espero que me puedan ayudar.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<LiquidCrystal_I2C.h>
#include<Wire.h>
const int bot1 = 8;
const int bot2 = 9;
const int bot3 = 10;
int boton1;
int boton2;
int boton3;
int tipo;
int tiempo;
int precio;
LiquidCrystal_I2C lcd (0x27, 16, 2);
void setup() {
pinMode(bot1, INPUT);
pinMode(bot2, INPUT);
pinMode(bot3, INPUT);
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.clear();
}
void loop() {
boton1 = digitalRead(bot1);
boton2 = digitalRead(bot2);
boton3 = digitalRead(bot3);
if (boton1 = 1) {
tipo == 1;
}
if (boton2 = 1) {
tipo == 2;
}
if (boton3 = 1) {
tiempo++;
delay(1000);
}
lcd.setCursor(0, 0);
lcd.print("TIEMPO:");
lcd.setCursor(7, 0);
lcd.print(tiempo);
lcd.setCursor(0, 1);
lcd.print("PRECIO:");
lcd.setCursor(7, 1);
lcd.print(precio);
}
Valora esta pregunta


0