#include SoftwareSerial monserial(0, 1); long distancia; long tiempo; int trigger=10; int echo=9; int ther=A2; float temp; float value; float reading; void setup() { // put your setup code here, to run once: pinMode(ther,INPUT); pinMode(trigger, OUTPUT); pinMode(echo, INPUT); monserial.begin(9600); } void loop() { // put your main code here, to run repeatedly: digitalWrite(trigger,LOW); delayMicroseconds(5); digitalWrite(trigger,HIGH); delayMicroseconds(10); tiempo=pulseIn(echo,HIGH); distancia= int(0.0175*tiempo); value=analogRead(ther); reading = (1023.0 / value) - 2.0;) temp = reading*100.0; monserial.print(distancia); monserial.println(temp); }