Paso 4: código:
int sensorread1 = A0;
int val1 = 0;
int sensorread2 = A1;
int val2 = 0;
int sensorread3 = A2;
val3 int = 0;
int sensorread4 = A3;
val4 int = 0;
int pin1 = 2;
int pin2 = 3;
pin3 int = 6;
pin4 int = 7;
pin5 int = 5;
int a, b, c, d el;
int y;
void setup()
{
Serial.Begin(9600);
pinMode(sensorread1,INPUT);
pinMode(sensorread2,INPUT);
pinMode(sensorread3,INPUT);
pinMode(sensorread4,INPUT);
pinMode(pin1,INPUT);
pinMode(pin2,INPUT);
pinMode(pin3,INPUT);
pinMode(pin4,INPUT);
pinMode(pin5,INPUT);
}
void loop()
{
Si (digitalRead(pin1))
{val1=(analogRead(sensorread1));
Serial.println(val1);
Delay(2000); Si (val1 > = 265 & & val1 < = 295)
{
a = 1;
Serial.println(a);
}
else if (val1 > = 155 & & val1 < = 180)
{
a = 2;
Serial.println(a);
}
Else {}
Serial.println("");
} } /*=========================================================================================*/
Si (digitalRead(pin2))
{=(analogRead(sensorread2)); val2
Serial.println(val2);
Delay(2000);
Si (val2 > = 170 & & val2 < = 230)
{
b = 3;
Serial.println(b);
}
else if (val2 > = 500)
{
b = 4;
Serial.println(b);
}
otra cosa
{
b = 5;
Serial.println(b); } } /*=========================================================================================*/
Si (digitalRead(pin3))
{
val3=(analogRead(sensorread3));
Serial.println(val3);
Delay(2000);
Si (val3 > = 320 & & val3 < = 340)
{
c = 6;
Serial.println(c);
}
else if (val3 > = 260 & & val3 < = 290)
{
c = 7;
Serial.println(c);
}
otra cosa
{
c = 8;
Serial.println("8");
} } /*========================================================================================*/
Si (digitalRead(pin4))
{val4=(analogRead(sensorread4));
Serial.println(val4);
Delay(2000);
Si (val4 > = 275 & & val4 < = 300)
{
Serial.println("+");
}
else if (val4 < = 275)
{Serial.println("*");}
otra cosa
{
Serial.println("");
} } /*==========================================================================================*/
if(digitalRead(pin5))
{
Si (val4 > = 275 & & val4 < = 300)
{
y = c + a;
Serial.println(ANS);
}
else if (val4 < = 275)
{
ANS = c * b;
Serial.println(ANS);
} } }